TalkUHulk / ai.deploy.box

A toolbox for deep learning model deployment using C++ YoloX | YoloV7 | YoloV8 | Gan | OCR | MobileVit | Scrfd | MobileSAM | StableDiffusion
http://www.hulk.show/aidb-webassembly-demo/
MIT License
449 stars 22 forks source link

add model #3

Closed naonao-cola closed 1 year ago

naonao-cola commented 1 year ago

请问一下如何集成自己的模型

TalkUHulk commented 1 year ago

请问一下如何集成自己的模型

在对应的config里增加模型配置,比如onnx_config.yaml

      SCRFD_2_5G_KPS: &scrfd_2_5g_kps
      name: "SCRFD_2.5G_KPS"
      model: *mp_scrfd_2_5g
      backend: "ONNX"
      detail: *scrfd_detail

mp_scrfd_2_5g为模型路径:

SCRFD_2_5G_KPS: &mp_scrfd_2_5g "./models/onnx/scrfd/scrfd_2.5g_kps_simplify"

scrfd_detail为详细的模型相关信息:

SCRFD: &scrfd_detail
    encrypt: false
    num_thread: 4
    device: "CPU"
    PreProcess:
      shape: &shape
        width: 640
        height: 640
        channel: 3
        batch: 1
      keep_ratio: true
      mean:
        - 127.5
        - 127.5
        - 127.5
      var:
        - 128.0
        - 128.0
        - 128.0
      border_constant:
        - 0.0
        - 0.0
        - 0.0
      imageformat: "RGB"
      inputformat: &format "NCHW"

    input_node1: &in_node1
      input_name: "images"
      format: *format
      shape: *shape
    input_nodes:
      - *in_node1
    output_nodes:
      - "out0"
      - "out1"
      - "out2"
      - "out3"
      - "out4"
      - "out5"
      - "out6"
      - "out7"
      - "out8"

最后在AIDBZOO里声明下模型: scrfd_2.5g_kps: *scrfd_2_5g_kps

后续有需要就重写模型的后处理。

TalkUHulk commented 1 year ago

如果没有问题,我将关闭这个issue。