Răsfoiți Sursa

Merge pull request #1801 from TingquanGao/develop

support to specify inference model directory in CLI
cuicheng01 1 an în urmă
părinte
comite
d36785994f
36 a modificat fișierele cu 104 adăugiri și 79 ștergeri
  1. 2 2
      docs/tutorials/INSTALL.md
  2. 20 20
      docs/tutorials/pipelines/pipeline_develop_tools.md
  3. 1 1
      paddlex/configs/instance_segmentation/Mask-RT-DETR-H.yaml
  4. 1 1
      paddlex/configs/instance_segmentation/Mask-RT-DETR-L.yaml
  5. 1 1
      paddlex/configs/object_detection/PP-YOLOE_plus-L.yaml
  6. 1 1
      paddlex/configs/object_detection/PP-YOLOE_plus-M.yaml
  7. 1 1
      paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml
  8. 1 1
      paddlex/configs/object_detection/PP-YOLOE_plus-X.yaml
  9. 1 1
      paddlex/configs/object_detection/PicoDet-L.yaml
  10. 1 1
      paddlex/configs/object_detection/PicoDet-S.yaml
  11. 1 1
      paddlex/configs/object_detection/RT-DETR-H.yaml
  12. 1 1
      paddlex/configs/object_detection/RT-DETR-L.yaml
  13. 1 1
      paddlex/configs/object_detection/RT-DETR-R18.yaml
  14. 1 1
      paddlex/configs/object_detection/RT-DETR-R50.yaml
  15. 1 1
      paddlex/configs/object_detection/RT-DETR-X.yaml
  16. 1 1
      paddlex/configs/structure_analysis/PicoDet_layout_1x.yaml
  17. 1 1
      paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml
  18. 1 1
      paddlex/configs/ts_anomaly_detection/DLinear_ad.yaml
  19. 1 1
      paddlex/configs/ts_anomaly_detection/Nonstationary_ad.yaml
  20. 1 1
      paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml
  21. 1 1
      paddlex/configs/ts_anomaly_detection/TimesNet_ad.yaml
  22. 1 1
      paddlex/configs/ts_classification/TimesNet_cls.yaml
  23. 1 1
      paddlex/configs/ts_forecast/DLinear.yaml
  24. 1 1
      paddlex/configs/ts_forecast/NLinear.yaml
  25. 1 1
      paddlex/configs/ts_forecast/Nonstationary.yaml
  26. 1 1
      paddlex/configs/ts_forecast/PatchTST.yaml
  27. 1 1
      paddlex/configs/ts_forecast/RLinear.yaml
  28. 1 1
      paddlex/configs/ts_forecast/TiDE.yaml
  29. 1 1
      paddlex/configs/ts_forecast/TimesNet.yaml
  30. 13 6
      paddlex/paddlex_cli.py
  31. 8 4
      paddlex/pipelines/OCR/pipeline.py
  32. 6 4
      paddlex/pipelines/base/pipeline.py
  33. 7 4
      paddlex/pipelines/image_classification/pipeline.py
  34. 7 4
      paddlex/pipelines/instance_segmentation/pipeline.py
  35. 7 4
      paddlex/pipelines/object_detection/pipeline.py
  36. 7 4
      paddlex/pipelines/semantic_segmentation/pipeline.py

+ 2 - 2
docs/tutorials/INSTALL.md

@@ -10,7 +10,7 @@ PaddleX 官方镜像中已经内置了 PaddlePaddle、PaddleX,无需单独安
 
 ```bash
 # 对于 CUDA11.8 用户
-sudo nvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it registry.baidubce.com/paddlex/paddlex:3.0.0b0-gpu-cuda11.8-cudnn8.9-trt8.5 /bin/bash
+sudo nvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it registry.baidubce.com/paddlex/paddlex:3.0.0b1-gpu-cuda11.8-cudnn8.9-trt8.5 /bin/bash
 
 # 对于 CUDA12.3 用户
 sudo docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it registry.baidubce.com/paddlex/paddlex:3.0.0b0-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash
@@ -31,7 +31,7 @@ sudo docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it
 ```bash
 # 对于 gpu 用户
 # CUDA11.8 用户
-sudo nvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it registry.baidubce.com/paddlepaddle/paddle:3.0.0b0-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash
+sudo nvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8G --network=host -it registry.baidubce.com/paddlepaddle/paddle:3.0.0b1-gpu-cuda11.8-cudnn8.6-trt8.5 /bin/bash
 
 # CUDA12.3 用户
 sudo nvidia-docker run --name paddlex -v $PWD:/paddle  --shm-size=8G --network=host -it registry.baidubce.com/paddlepaddle/paddle:3.0.0b0-gpu-cuda12.3-cudnn9.0-trt8.6 /bin/bash

+ 20 - 20
docs/tutorials/pipelines/pipeline_develop_tools.md

@@ -1,15 +1,30 @@
 # PaddleX 模型产线开发工具
 
-PaddleX 提供了丰富的模型产线,模型产线由一个或多个模型组合实现,每个模型产线都能够解决特定的场景任务问题。PaddleX 所提供的模型产线均支持在线体验,如果效果不及预期,也同样支持使用私有数据微调模型,并且 PaddleX 提供了 Python API,方便将产线集成到个人项目中。在使用之前,您首先需要安装 PaddleX, 安装方式请参考[PaddleX 安装](../INSTALL.md)。此处以一个车牌识别的任务为例子,介绍模型产线工具的使用流程。
+**<center>PaddleX 模型产线开发流程图</center>**
+
+```mermaid
+graph LR
+    select_pipeline(选择产线) --> online_experience[快速体验]
+    online_experience --> online_ok{效果满意?}
+    online_ok --不满意--> select_model[选择模型]
+    select_model --> model_finetune[模型微调]
+    online_ok --满意--> development_integration(开发集成/部署)
+    model_finetune --> pipeline_test[产线测试]
+    pipeline_test --> test_ok{效果满意?}
+    test_ok --不满意--> select_model
+    test_ok --满意--> development_integration
+```
+
+PaddleX 提供了丰富的模型产线,模型产线由一个或多个模型组合实现,每个模型产线都能够解决特定的场景任务问题。PaddleX 所提供的模型产线均支持快速体验,如果效果不及预期,也同样支持使用私有数据微调模型,并且 PaddleX 提供了 Python API,方便将产线集成到个人项目中。在使用之前,您首先需要安装 PaddleX, 安装方式请参考[PaddleX 安装](../INSTALL.md)。此处以一个车牌识别的任务为例子,介绍模型产线工具的使用流程。
 
 - 1.【**选择产线**】:首先,需要根据您的任务场景,选择对应的 PaddleX 产线,此处为车牌识别,需要了解到这个任务属于 OCR 任务,对应 PaddleX 的通用 OCR 产线。如果无法确定任务和产线的对应关系,您可以在 PaddleX 支持的模型产线[模型产线列表](./support_pipeline_list.md)中了解相关产线的能力介绍。
-- 2.【**在线体验**】PaddleX 提供了两种在线体验的方式,一种是可以直接通过 PaddleX wheel 包在本地体验,另外一种是可以在**AI Studio 星河社区**上体验。
+- 2.【**快速体验**】PaddleX 提供了两种体验的方式,一种是可以直接通过 PaddleX wheel 包在本地体验,另外一种是可以在**AI Studio 星河社区**上体验。
   - 本地体验方式:
     ```bash
     paddlex --pipeline OCR --model PP-OCRv4_mobile_det PP-OCRv4_mobile_rec --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --device gpu:0
     ```
     **注:** 通用 OCR 产线是一个多模型串联的产线,包含文本检测模型(如 `PP-OCRv4_mobile_det`)和文本识别模型(如 `PP-OCRv4_mobile_rec`),因此需要指定两个模型进行体验。
-  - 星河社区体验方式:前往[AI Studio 星河社区](https://aistudio.baidu.com/pipeline/mine),点击【创建产线】,创建**通用 OCR** 产线进行在线体验;
+  - 星河社区体验方式:前往[AI Studio 星河社区](https://aistudio.baidu.com/pipeline/mine),点击【创建产线】,创建**通用 OCR** 产线进行快速体验;
 - 3.【**选择模型**】(可选)当体验完该产线之后,需要确定产线是否符合预期(包含精度、速度等),产线包含的模型是否需要继续微调,如果模型的速度或者精度不符合预期,则需要根据[模型选择](./model_select.md)选择可替换的模型继续测试,确定效果是否满意。如果最终效果均不满意,则需要微调模型。在确定微调的模型时,需要根据测试的情况确定微调其中的哪个模型,如发现文字的定位不准,则需要微调文本检测模型,如果发现文字的识别不准,则需要微调文本识别模型。  
 - 4.【**模型微调**】(可选)在第 3 步选择好对应的模型后,即可使用**单模型开发工具**以低代码的方式进行模型微调训练和优化,如此处需要优化文本识别模型(`PP-OCRv4_mobile_rec`),则只需要完成【数据校验】和【模型训练】,二者命令如下:
 
@@ -17,11 +32,11 @@ PaddleX 提供了丰富的模型产线,模型产线由一个或多个模型组
   # 数据校验
   python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \
       -o Global.mode=check_dataset \
-      -o Global.dataset_dir=your/dataset_dir 
+      -o Global.dataset_dir=your/dataset_dir
   # 模型训练
   python main.py -c paddlex/configs/text_recognition/PP-OCRv4_mobile_rec.yaml \
       -o Global.mode=train \
-      -o Global.dataset_dir=your/dataset_dir 
+      -o Global.dataset_dir=your/dataset_dir
   ```
   关于模型更多的训练和优化内容,请参考[PaddleX 单模型开发工具](../models/model_develop_tools.md);
 - 5.【**产线测试**】(可选)将产线中的模型替换为微调后的模型进行测试,如:
@@ -58,18 +73,3 @@ PaddleX 提供了丰富的模型产线,模型产线由一个或多个模型组
   其他产线的 Python API 集成方式可以参考[PaddleX 模型产线推理预测](./pipeline_inference.md)。
 
   PadleX 同样提供了高性能的离线部署和服务化部署方式,具体参考[基于 FastDeploy 的模型产线部署](./pipeline_deployment_with_fastdeploy.md)。
-
-**附:PaddleX 模型产线开发流程图**
-
-```mermaid
-graph LR
-    select_pipeline(选择产线) --> online_experience[在线体验]
-    online_experience --> online_ok{效果满意?}
-    online_ok --不满意--> select_model[选择模型]
-    select_model --> model_finetune[模型微调]
-    online_ok --满意--> development_integration(开发集成/部署)
-    model_finetune --> pipeline_test[产线测试]
-    pipeline_test --> test_ok{效果满意?}
-    test_ok --不满意--> select_model
-    test_ok --满意--> development_integration
-```

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

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

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/structure_analysis/PicoDet_layout_1x.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert:
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split:
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_anomaly_detection/AutoEncoder_ad.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_anomaly_detection/DLinear_ad.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_anomaly_detection/Nonstationary_ad.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_anomaly_detection/PatchTST_ad.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_anomaly_detection/TimesNet_ad.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_classification/TimesNet_cls.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_forecast/DLinear.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_forecast/NLinear.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_forecast/Nonstationary.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_forecast/PatchTST.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_forecast/RLinear.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_forecast/TiDE.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 1 - 1
paddlex/configs/ts_forecast/TimesNet.yaml

@@ -8,7 +8,7 @@ Global:
 CheckDataset:
   convert: 
     enable: False
-    src_dataset_type: nul
+    src_dataset_type: null
   split: 
     enable: False
     train_percent: null

+ 13 - 6
paddlex/paddlex_cli.py

@@ -1,5 +1,5 @@
 # copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
-# 
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 import os
 import argparse
 import textwrap
@@ -32,6 +31,11 @@ def args_cfg():
         """
         return v.lower() in ("true", "t", "1")
 
+    def str2None(s):
+        """convert to None type if it is "None"
+        """
+        return None if s.lower() == 'none' else s
+
     parser = argparse.ArgumentParser()
 
     ################# install pdx #################
@@ -52,6 +56,7 @@ def args_cfg():
     parser.add_argument('--predict', action='store_true', default=True, help="")
     parser.add_argument('--pipeline', type=str, help="")
     parser.add_argument('--model', nargs='+', help="")
+    parser.add_argument('--model_dir', nargs='+', type=str2None, help="")
     parser.add_argument('--input', type=str, help="")
     parser.add_argument('--output', type=str, default="./", help="")
     parser.add_argument('--device', type=str, default='gpu:0', help="")
@@ -79,10 +84,12 @@ def install(args):
     return
 
 
-def pipeline_predict(pipeline, model_name_list, input_path, output, device):
+def pipeline_predict(pipeline, model_name_list, model_dir_list, input_path,
+                     output, device):
     """pipeline predict
     """
-    pipeline = build_pipeline(pipeline, model_name_list, output, device)
+    pipeline = build_pipeline(pipeline, model_name_list, model_dir_list, output,
+                              device)
     pipeline.predict({"input_path": input_path})
 
 
@@ -94,5 +101,5 @@ def main():
     if args.install:
         install(args)
     else:
-        return pipeline_predict(args.pipeline, args.model, args.input,
-                                args.output, args.device)
+        return pipeline_predict(args.pipeline, args.model, args.model_dir,
+                                args.input, args.output, args.device)

+ 8 - 4
paddlex/pipelines/OCR/pipeline.py

@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 import os
 import cv2
 
@@ -110,15 +109,20 @@ Only support: {text_rec_models}."
 
         return result
 
-    def update_model_name(self, model_name_list):
-        """update model name and re
+    def update_model(self, model_name_list, model_dir_list):
+        """update model
 
         Args:
-            model_list (list): list of model name.
+            model_name_list (list): list of model name.
+            model_dir_list (list): list of model directory.
         """
         assert len(model_name_list) == 2
         self.text_det_model_name = model_name_list[0]
         self.text_rec_model_name = model_name_list[1]
+        if model_dir_list:
+            assert len(model_dir_list) == 2
+            self.text_det_model_dir = model_dir_list[0]
+            self.text_rec_model_dir = model_dir_list[1]
 
     def get_kernel_option(self):
         """get kernel option

+ 6 - 4
paddlex/pipelines/base/pipeline.py

@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 from abc import ABC, abstractmethod
 
 from ...utils.misc import AutoRegisterABCMetaClass
@@ -21,6 +20,7 @@ from ...utils.misc import AutoRegisterABCMetaClass
 def build_pipeline(
         pipeline_name: str,
         model_list: list,
+        model_dir_list: list,
         output: str,
         device: str, ) -> "BasePipeline":
     """build model evaluater
@@ -33,6 +33,7 @@ def build_pipeline(
     """
     pipeline = BasePipeline.get(pipeline_name)(output=output, device=device)
     pipeline.update_model_name(model_list)
+    pipeline.update_model(model_list, model_dir_list)
     pipeline.load_model()
     return pipeline
 
@@ -52,11 +53,12 @@ class BasePipeline(ABC, metaclass=AutoRegisterABCMetaClass):
         raise NotImplementedError
 
     @abstractmethod
-    def update_model_name(self, model_list: list) -> dict:
-        """update model name and re
+    def update_model(self, model_name_list, model_dir_list):
+        """update model
 
         Args:
-            model_list (list): list of model name.
+            model_name_list (list): list of model name.
+            model_dir_list (list): list of model directory.
         """
         raise NotImplementedError
 

+ 7 - 4
paddlex/pipelines/image_classification/pipeline.py

@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 from ..base import BasePipeline
 from ...modules.image_classification.model_list import MODELS
 from ...modules import create_model, PaddleInferenceOption
@@ -69,14 +68,18 @@ class ClsPipeline(BasePipeline):
         kernel_option.set_device(self.device)
         return kernel_option
 
-    def update_model_name(self, model_name_list):
-        """update model name and re
+    def update_model(self, model_name_list, model_dir_list):
+        """update model
 
         Args:
-            model_list (list): list of model name.
+            model_name_list (list): list of model name.
+            model_dir_list (list): list of model directory.
         """
         assert len(model_name_list) == 1
         self.model_name = model_name_list[0]
+        if model_dir_list:
+            assert len(model_dir_list) == 1
+            self.model_dir = model_dir_list[0]
 
     def get_input_keys(self):
         """get dict keys of input argument input

+ 7 - 4
paddlex/pipelines/instance_segmentation/pipeline.py

@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 from ..base import BasePipeline
 from ...modules.instance_segmentation.model_list import MODELS
 from ...modules import create_model, PaddleInferenceOption
@@ -68,14 +67,18 @@ class InstanceSegPipeline(BasePipeline):
         kernel_option.set_device(self.device)
         return kernel_option
 
-    def update_model_name(self, model_name_list):
-        """update model name and re
+    def update_model(self, model_name_list, model_dir_list):
+        """update model
 
         Args:
-            model_list (list): list of model name.
+            model_name_list (list): list of model name.
+            model_dir_list (list): list of model directory.
         """
         assert len(model_name_list) == 1
         self.model_name = model_name_list[0]
+        if model_dir_list:
+            assert len(model_dir_list) == 1
+            self.model_dir = model_dir_list[0]
 
     def get_input_keys(self):
         """get dict keys of input argument input

+ 7 - 4
paddlex/pipelines/object_detection/pipeline.py

@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 from ..base import BasePipeline
 from ...modules.object_detection.model_list import MODELS
 from ...modules import create_model, PaddleInferenceOption
@@ -67,14 +66,18 @@ class DetPipeline(BasePipeline):
         kernel_option = PaddleInferenceOption()
         kernel_option.set_device(self.device)
 
-    def update_model_name(self, model_name_list):
-        """update model name and re
+    def update_model(self, model_name_list, model_dir_list):
+        """update model
 
         Args:
-            model_list (list): list of model name.
+            model_name_list (list): list of model name.
+            model_dir_list (list): list of model directory.
         """
         assert len(model_name_list) == 1
         self.model_name = model_name_list[0]
+        if model_dir_list:
+            assert len(model_dir_list) == 1
+            self.model_dir = model_dir_list[0]
 
     def get_input_keys(self):
         """get dict keys of input argument input

+ 7 - 4
paddlex/pipelines/semantic_segmentation/pipeline.py

@@ -12,7 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 from ..base import BasePipeline
 from ...modules.semantic_segmentation.model_list import MODELS
 from ...modules import create_model, PaddleInferenceOption
@@ -68,14 +67,18 @@ class SegPipeline(BasePipeline):
         kernel_option.set_device(self.device)
         return kernel_option
 
-    def update_model_name(self, model_name_list):
-        """update model name and re
+    def update_model(self, model_name_list, model_dir_list):
+        """update model
 
         Args:
-            model_list (list): list of model name.
+            model_name_list (list): list of model name.
+            model_dir_list (list): list of model directory.
         """
         assert len(model_name_list) == 1
         self.model_name = model_name_list[0]
+        if model_dir_list:
+            assert len(model_dir_list) == 1
+            self.model_dir = model_dir_list[0]
 
     def get_input_keys(self):
         """get dict keys of input argument input