瀏覽代碼

Fix tutorial docs (#3279)

* fix OVS doc

* fix modules docs

* fix tutorial docs

* fix sth
Zhang Zelun 9 月之前
父節點
當前提交
70c6c4414e

+ 31 - 8
docs/practical_tutorials/semantic_segmentation_road_tutorial.en.md

@@ -83,7 +83,7 @@ tar -xf ./dataset/semantic-segmentation-makassaridn-road-dataset.tar -C ./datase
 To verify the dataset, simply use the following command:
 
 ```bash
-python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
+python main.py -c paddlex/configs/modules/semantic_segmentation/PP-LiteSeg-T.yaml \
     -o Global.mode=check_dataset \
     -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset
 ```
@@ -110,9 +110,9 @@ After executing the above command, PaddleX will verify the dataset and collect b
   "analysis": {
     "histogram": "check_dataset/histogram.png"
   },
-  "dataset_path": "./dataset/semantic-segmentation-makassaridn-road-dataset",
+  "dataset_path": "semantic-segmentation-makassaridn-road-dataset",
   "show_type": "image",
-  "dataset_type": "COCODetDataset"
+  "dataset_type": "SegDataset"
 }
 ```
 
@@ -158,7 +158,7 @@ Data conversion and splitting can be enabled simultaneously. For data splitting,
 Before training, ensure that you have validated your dataset. To complete the training of a PaddleX model, simply use the following command:
 
 ```bash
-python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
+python main.py -c paddlex/configs/modules/semantic_segmentation/PP-LiteSeg-T.yaml \
     -o Global.mode=train \
     -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset \
     -o Train.num_classes=4
@@ -196,7 +196,7 @@ After completing model training, all outputs are saved in the specified output d
 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:
 
 ```bash
-python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
+python main.py -c paddlex/configs/modules/semantic_segmentation/PP-LiteSeg-T.yaml \
     -o Global.mode=evaluate \
     -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset
 ```
@@ -316,7 +316,7 @@ Changing Epoch Results:
 Replace the model in the production line with the fine-tuned model for testing, for example:
 
 ```bash
-python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
+python main.py -c paddlex/configs/modules/semantic_segmentation/PP-LiteSeg-T.yaml \
     -o Global.mode=predict \
     -o Predict.model_dir="output/best_model/inference" \
     -o Predict.input="https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png"
@@ -331,16 +331,39 @@ The prediction results will be generated under `./output`, where the prediction
 
 ## 7. Development Integration/Deployment
 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:
+
+1. If you need to use the fine-tuned model weights, you can obtain the configuration file for the semantic_segmentation pipeline and load it for prediction. You can execute the following command to save the results in my_path:
+
+```
+paddlex --get_pipeline_config semantic_segmentation --save_path ./my_path
+```
+
+Fill in the local path of the fine-tuned model weights into the `model_dir` field in the configuration file. If you need to directly apply the general semantic segmentation pipeline to your Python project, you can refer to the following example:
+
+```yaml
+pipeline_name: semantic_segmentation
+
+SubModules:
+  SemanticSegmentation:
+    module_name: semantic_segmentation
+    model_name: PP-LiteSeg-T
+    model_dir: null # Replace this with the local path to your trained model weights.
+    batch_size: 1
+    target_size: None
+```
+
+Subsequently, in your Python code, you can utilize the pipeline as follows:
+
 ```python
 from paddlex import create_pipeline
-pipeline = create_pipeline(pipeline="paddlex/pipelines/semantic_segmentation.yaml")
+pipeline = create_pipeline(pipeline="my_path/semantic_segmentation.yaml")
 output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png")
 for res in output:
     res.print() # Print the structured output of the prediction
     res.save_to_img("./output/") # Save the visualized image of the result
     res.save_to_json("./output/") # Save the structured output of the prediction
 ```
+
 For more parameters, please refer to [General Semantic Segmentation Pipeline Usage Tutorial](../pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.en.md).
 
 2. Additionally, PaddleX offers three other deployment methods, detailed as follows:

+ 29 - 8
docs/practical_tutorials/semantic_segmentation_road_tutorial.md

@@ -84,7 +84,7 @@ tar -xf ./dataset/semantic-segmentation-makassaridn-road-dataset.tar -C ./datase
 在对数据集校验时,只需一行命令:
 
 ```bash
-python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
+python main.py -c paddlex/configs/modules/semantic_segmentation/PP-LiteSeg-T.yaml \
     -o Global.mode=check_dataset \
     -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset
 ```
@@ -110,9 +110,9 @@ python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
   "analysis": {
     "histogram": "check_dataset/histogram.png"
   },
-  "dataset_path": "./dataset/semantic-segmentation-makassaridn-road-dataset",
+  "dataset_path": "semantic-segmentation-makassaridn-road-dataset",
   "show_type": "image",
-  "dataset_type": "COCODetDataset"
+  "dataset_type": "SegDataset"
 }
 ```
 上述校验结果中,check_pass 为 True 表示数据集格式符合要求,其他部分指标的说明如下:
@@ -156,7 +156,7 @@ python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
 在训练之前,请确保您已经对数据集进行了校验。完成 PaddleX 模型的训练,只需如下一条命令:
 
 ```bash
-python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
+python main.py -c paddlex/configs/modules/semantic_segmentation/PP-LiteSeg-T.yaml \
     -o Global.mode=train \
     -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset \
     -o Train.num_classes=4
@@ -194,7 +194,7 @@ PaddleX 中每个模型都提供了模型开发的配置文件,用于设置相
 在完成模型训练后,可以对指定的模型权重文件在验证集上进行评估,验证模型精度。使用 PaddleX 进行模型评估,只需一行命令:
 
 ```bash
-python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
+python main.py -c paddlex/configs/modules/semantic_segmentation/PP-LiteSeg-T.yaml \
     -o Global.mode=evaluate \
     -o Global.dataset_dir=./dataset/semantic-segmentation-makassaridn-road-dataset
 ```
@@ -314,7 +314,7 @@ python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
 将产线中的模型替换为微调后的模型进行测试,如:
 
 ```bash
-python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
+python main.py -c paddlex/configs/modules/semantic_segmentation/PP-LiteSeg-T.yaml \
     -o Global.mode=predict \
     -o Predict.model_dir="output/best_model/inference" \
     -o Predict.input="https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png"
@@ -329,16 +329,37 @@ python main.py -c paddlex/configs/semantic_segmentation/PP-LiteSeg-T.yaml \
 
 ## 7. 开发集成/部署
 如果通用语义分割产线可以达到您对产线推理速度和精度的要求,您可以直接进行开发集成/部署。
-1. 直接将训练好的模型应用在您的 Python 项目中,可以参考如下示例代码,并将`paddlex/pipelines/semantic_segmentation.yaml`配置文件中的`Pipeline.model`修改为自己的模型路径:
+1. 若您需要使用微调后的模型权重,可以获取 semantic_segmentation 产线配置文件,并加载配置文件进行预测。可执行如下命令将结果保存在 `my_path` 中:
+
+```
+paddlex --get_pipeline_config semantic_segmentation --save_path ./my_path
+```
+
+将微调后模型权重的本地路径填写至产线配置文件中的 `model_dir` 即可, 若您需要将通用语义分割产线直接应用在您的 Python 项目中,可以参考 如下示例:
+
+```yaml
+pipeline_name: semantic_segmentation
+
+SubModules:
+  SemanticSegmentation:
+    module_name: semantic_segmentation
+    model_name: PP-LiteSeg-T
+    model_dir: null # 此处替换为您训练后得到的模型权重本地路径
+    batch_size: 1
+    target_size: None
+```
+
+随后,在您的 Python 代码中,您可以这样使用产线:
 ```python
 from paddlex import create_pipeline
-pipeline = create_pipeline(pipeline="paddlex/pipelines/semantic_segmentation.yaml")
+pipeline = create_pipeline(pipeline="my_path/semantic_segmentation.yaml")
 output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/application/semantic_segmentation/makassaridn-road_demo.png")
 for res in output:
     res.print() # 打印预测的结构化输出
     res.save_to_img("./output/") # 保存结果可视化图像
     res.save_to_json("./output/") # 保存预测的结构化输出
 ```
+
 更多参数请参考 [语义分割产线使用教程](../pipeline_usage/tutorials/cv_pipelines/semantic_segmentation.md)。
 
 2. 此外,PaddleX 也提供了其他三种部署方式,详细说明如下:

+ 29 - 7
docs/practical_tutorials/small_object_detection_tutorial.en.md

@@ -96,7 +96,7 @@ tar -xf ./dataset/remote_scene_object_detection.tar -C ./dataset/
 When validating the dataset, you only need one line of command:
 
 ```bash
-python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
+python main.py -c paddlex/configs/modules/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
     -o Global.mode=check_dataset \
     -o Global.dataset_dir=./dataset/remote_scene_object_detection
 ```
@@ -138,7 +138,7 @@ After executing the above command, PaddleX will validate the dataset and count t
   "analysis": {
     "histogram": "check_dataset\/histogram.png"
   },
-  "dataset_path": "\/git_commit\/final_commit_dev\/PaddleX\/_zzl_sod\/rdet_dota_examples",
+  "dataset_path": "rdet_dota_examples",
   "show_type": "image",
   "dataset_type": "COCODetDataset"
 }
@@ -183,7 +183,7 @@ Dataset conversion and dataset splitting support being enabled at the same time.
 Before training, please ensure that you have validated the dataset. To complete the training of the PaddleX model, you only need the following command:
 
 ```bash
-python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
+python main.py -c paddlex/configs/modules/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
     -o Global.mode=train \
     -o Global.dataset_dir=./dataset/remote_scene_object_detection \
     -o Train.epochs_iters=80
@@ -221,7 +221,7 @@ After completing the model training, all outputs are saved under the specified o
 After completing the model training, you can evaluate the specified model weight file on the validation set to verify the model accuracy. Using PaddleX for model evaluation requires only one command:
 
 ```bash
-python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
+python main.py -c paddlex/configs/modules/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
     -o Global.mode=evaluate \
     -o Global.dataset_dir=./dataset/remote_scene_object_detection
 ```
@@ -267,7 +267,7 @@ Experiment results after changing epoch:
 Replace the model in the pipeline with the fine-tuned model for testing, such as:
 
 ```bash
-python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
+python main.py -c paddlex/configs/modules/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
     -o Global.mode=predict \
     -o Predict.model_dir="output/best_model/inference" \
     -o Predict.input="https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remote-scene-det_example.png"
@@ -282,10 +282,32 @@ Through the above, the prediction results can be generated under `./output`, as
 
 ## 7. Development Integration/Deployment
 If the small object detection pipeline can meet your requirements for pipeline inference speed and accuracy, you can directly proceed with development integration/deployment.
-1. Directly apply the trained model in your Python project. You can refer to the following sample code, and modify `Pipeline.model` in `paddlex/pipelines/small_object_detection.yaml` configuration file to your own model path `output/best_model/inference`:
+
+1. If you need to use the fine-tuned model weights, you can obtain the configuration file for the small_object_detection pipeline and load it for prediction. You can execute the following command to save the results in my_path:
+
+```
+paddlex --get_pipeline_config small_object_detection --save_path ./my_path
+```
+
+Fill in the local path of the fine-tuned model weights into the `model_dir` field in the configuration file. If you need to directly apply the general small_object_detection pipeline to your Python project, you can refer to the following example:
+
+```yaml
+pipeline_name: small_object_detection
+
+SubModules:
+  SmallObjectDetection:
+    module_name: small_object_detection
+    model_name: PP-YOLOE_plus_SOD-L
+    model_dir: null # Replace this with the local path to your trained model weights.
+    batch_size: 1
+    threshold: 0.5
+```
+
+Subsequently, in your Python code, you can utilize the pipeline as follows:
+
 ```python
 from paddlex import create_pipeline
-pipeline = create_pipeline(pipeline="paddlex/pipelines/small_object_detection.yaml")
+pipeline = create_pipeline(pipeline="my_path/small_object_detection.yaml")
 output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remote-scene-det_example.png")
 for res in output:
     res.print() # Print the structured output of the prediction

+ 29 - 8
docs/practical_tutorials/small_object_detection_tutorial.md

@@ -102,7 +102,7 @@ tar -xf ./dataset/remote_scene_object_detection.tar -C ./dataset/
 在对数据集校验时,只需一行命令:
 
 ```bash
-python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
+python main.py -c paddlex/configs/modules/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
     -o Global.mode=check_dataset \
     -o Global.dataset_dir=./dataset/remote_scene_object_detection
 ```
@@ -144,7 +144,7 @@ python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-large
   "analysis": {
     "histogram": "check_dataset\/histogram.png"
   },
-  "dataset_path": "\/git_commit\/final_commit_dev\/PaddleX\/_zzl_sod\/rdet_dota_examples",
+  "dataset_path": "rdet_dota_examples",
   "show_type": "image",
   "dataset_type": "COCODetDataset"
 }
@@ -190,7 +190,7 @@ python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-large
 在训练之前,请确保您已经对数据集进行了校验。完成 PaddleX 模型的训练,只需如下一条命令:
 
 ```bash
-python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
+python main.py -c paddlex/configs/modules/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
     -o Global.mode=train \
     -o Global.dataset_dir=./dataset/remote_scene_object_detection \
     -o Train.epochs_iters=80
@@ -228,7 +228,7 @@ PaddleX 中每个模型都提供了模型开发的配置文件,用于设置相
 在完成模型训练后,可以对指定的模型权重文件在验证集上进行评估,验证模型精度。使用 PaddleX 进行模型评估,只需一行命令:
 
 ```bash
-python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
+python main.py -c paddlex/configs/modules/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
     -o Global.mode=evaluate \
     -o Global.dataset_dir=./dataset/remote_scene_object_detection
 ```
@@ -274,7 +274,7 @@ python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-large
 将产线中的模型替换为微调后的模型进行测试,如:
 
 ```bash
-python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
+python main.py -c paddlex/configs/modules/small_object_detection/PP-YOLOE_plus_SOD-largesize-L.yaml \
     -o Global.mode=predict \
     -o Predict.model_dir="output/best_model/inference" \
     -o Predict.input="https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remote-scene-det_example.png"
@@ -289,19 +289,40 @@ python main.py -c paddlex/configs/small_object_detection/PP-YOLOE_plus_SOD-large
 
 ## 7. 开发集成/部署
 如果小目标检测产线可以达到您对产线推理速度和精度的要求,您可以直接进行开发集成/部署。
-1. 直接将训练好的模型应用在您的 Python 项目中,可以参考如下示例代码,并将`paddlex/pipelines/small_object_detection.yaml`配置文件中的`Pipeline.model`修改为自己的模型路径`output/best_model/inference`:
+1. 若您需要使用微调后的模型权重,可以获取 small_object_detection 产线配置文件,并加载配置文件进行预测。可执行如下命令将结果保存在 `my_path` 中:
+
+```
+paddlex --get_pipeline_config small_object_detection --save_path ./my_path
+```
+
+将微调后模型权重的本地路径填写至产线配置文件中的 `model_dir` 即可, 若您需要将通用小目标检测产线直接应用在您的 Python 项目中,可以参考 如下示例:
+
+```yaml
+pipeline_name: small_object_detection
+
+SubModules:
+  SmallObjectDetection:
+    module_name: small_object_detection
+    model_name: PP-YOLOE_plus_SOD-L
+    model_dir: null # 此处替换为您训练后得到的模型权重本地路径
+    batch_size: 1
+    threshold: 0.5
+```
+
+随后,在您的 Python 代码中,您可以这样使用产线:
 ```python
 from paddlex import create_pipeline
-pipeline = create_pipeline(pipeline="paddlex/pipelines/small_object_detection.yaml")
+pipeline = create_pipeline(pipeline="my_path/small_object_detection.yaml")
 output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/remote-scene-det_example.png")
 for res in output:
     res.print() # 打印预测的结构化输出
     res.save_to_img("./output/") # 保存结果可视化图像
     res.save_to_json("./output/") # 保存预测的结构化输出
 ```
+
 更多参数请参考 [小目标检测产线使用教程](../pipeline_usage/tutorials/cv_pipelines/small_object_detection.md)。
 
-1. 此外,PaddleX 也提供了其他三种部署方式,详细说明如下:
+2. 此外,PaddleX 也提供了其他三种部署方式,详细说明如下:
 
 * 高性能部署:在实际生产环境中,许多应用对部署策略的性能指标(尤其是响应速度)有着较严苛的标准,以确保系统的高效运行与用户体验的流畅性。为此,PaddleX 提供高性能推理插件,旨在对模型推理及前后处理进行深度性能优化,实现端到端流程的显著提速,详细的高性能部署流程请参考 [PaddleX 高性能推理指南](../pipeline_deploy/high_performance_inference.md)。
 * 服务化部署:服务化部署是实际生产环境中常见的一种部署形式。通过将推理功能封装为服务,客户端可以通过网络请求来访问这些服务,以获取推理结果。PaddleX 支持用户以低成本实现产线的服务化部署,详细的服务化部署流程请参考 [PaddleX 服务化部署指南](../pipeline_deploy/serving.md)。