PaddlePaddle / PaddleX

All-in-One Development Tool based on PaddlePaddle(飞桨低代码开发工具)
Apache License 2.0
4.85k stars 955 forks source link

部署自己训练的模型报错 #2312

Open CashBai opened 1 week ago

CashBai commented 1 week ago

模型类型为PP-YOLOE_plus-L Inference.yml文件内容如下:

mode: paddle
draw_threshold: 0.5
metric: COCO
use_dynamic_shape: false
Global:
  pipeline_name: PP-YOLOE_plus-L
  model_name: PP-YOLOE_plus-L
arch: YOLO
min_subgraph_size: 3
Preprocess:
- interp: 2
  keep_ratio: false
  target_size:
  - 640
  - 640
  type: Resize
- mean:
  - 0.0
  - 0.0
  - 0.0
  norm_type: none
  std:
  - 1.0
  - 1.0
  - 1.0
  type: NormalizeImage
- type: Permute
label_list:
- pink
- black
- blue
Hpi:
  backend_config:
    openvino:
      cpu_num_threads: 8
    paddle_infer:
      cpu_num_threads: 8
      enable_log_info: false
    paddle_tensorrt:
      dynamic_shapes:
        im_shape:
        - - 1
          - 2
        - - 1
          - 2
        - - 1
          - 2
        image:
        - &id001
          - 1
          - 3
          - 640
          - 640
        - *id001
        - *id001
        scale_factor:
        - - 1
          - 2
        - - 1
          - 2
        - - 1
          - 2
      enable_log_info: false
      max_batch_size: 1
  selected_backends:
    cpu: openvino
    gpu: paddle_tensorrt
  supported_backends:
    cpu:
    - paddle_infer
    - openvino
    gpu:
    - paddle_infer
    - paddle_tensorrt

image 报错如下: image

zhang-prog commented 1 week ago

在 Inference.yml 中新增如下内容

......
Pipeline:
  model: 这里修改为微调后模型的本地路径
  device: "gpu"
  batch_size: 1
Global:
  pipeline_name: object_detection
  model_name: PP-YOLOE_plus-L
......

更多详情请参考 通用目标检测产线使用教程4.二次开发 部分

CashBai commented 1 week ago

@zhang-prog 这是个bug吗?后续会修复吗?

zhang-prog commented 1 week ago

不是bug,使用自训练的模型是需要加这些配置的。详细可以看 通用目标检测产线使用教程4.二次开发 部分

zhang-prog commented 6 days ago

抱歉,上述方法有误,正确方法应该参考 通用目标检测产线使用教程2.2 本地体验 ,具体步骤如下:

  1. 生成目标检测产线配置文件

    paddlex --get_pipeline_config object_detection --save_path ./
  2. 修改 object_detection.yaml 中的 model 为自训练模型的本地路径,类似

    
    Global:
    pipeline_name: object_detection
    input: https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png

Pipeline: model: ./PP-YOLOE_plus-L batch_size: 1

3. 然后在 `create_pipeline` 时使用 `object_detection.yaml`:

from paddlex import create_pipeline pipeline = create_pipeline(pipeline="./object_detection.yaml") output = pipeline.predict("general_object_detection_002.png") for res in output: res.print() ## 打印预测的结构化输出 res.save_to_img("./output/") ## 保存结果可视化图像 res.save_to_json("./output/") ## 保存预测的结构化输出