modelbox-ai / modelbox

A high performance, high expansion, easy to use framework for AI application. 为AI应用的开发者提供一套统一的高性能、易用的编程框架,快速基于AI全栈服务、开发跨端边云的AI行业应用,支持GPU,NPU加速。
https://modelbox-ai.com
Apache License 2.0
133 stars 38 forks source link

c++实现flowunit运行失败 #361

Open LostmanMing opened 1 year ago

LostmanMing commented 1 year ago

开发环境:rk3568开发板 rknpu,HiLens控制台提供的RK系列ModelBox SDK graph:

graphconf = """digraph video_test {
    node [shape=Mrecord]
    queue_size = 4
    batch_size = 1
    input1[type=input,flowunit=input,device=cpu,deviceid=0]
    data_source_parser[type=flowunit, flowunit=data_source_parser, device=cpu, deviceid=0]
    video_demuxer[type=flowunit, flowunit=video_demuxer, device=cpu, deviceid=0]
    video_decoder[type=flowunit, flowunit=video_decoder, device=rknpu, deviceid=0, pix_fmt=bgr]
    resize[type=flowunit,flowunit=resize,device=rknpu,deviceid=0, image_width=224, image_height=224]
    face_phone_infer[type=flowunit, flowunit=face_phone_infer, device=rknpu, deviceid=0]
    step1_post[type=flowunit,flowunit=step1_post,device=cpu,deviceid=0]
    draw_box[type=flowunit,flowunit=draw_box,device=cpu,deviceid=0]
    video_out[type=flowunit, flowunit=video_out, device=rknpu, deviceid=0]

    input1:input -> data_source_parser:in_data
    data_source_parser:out_video_url -> video_demuxer:in_video_url
    video_demuxer:out_video_packet -> video_decoder:in_video_packet
    video_decoder:out_video_frame -> resize:in_image
    resize:out_image -> face_phone_infer:Input
    face_phone_infer:Output -> step1_post:in_1
    video_decoder:out_video_frame -> draw_box:img_in
    step1_post:out_1 -> draw_box:box_in
    draw_box:out -> video_out:in_video_frame

}"""

编译信息:

root@iTOP-RK3568:/mnt/mmc/zgm/modelbox/rk3568/workspace/video_test $ ./build_project.sh
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/build
Scanning dependencies of target modelbox-unit-cpu-step1_post
[ 40%] Built target modelbox-unit-cpu-draw_box
[ 60%] Building CXX object flowunit_cpp/step1_post/CMakeFiles/modelbox-unit-cpu-step1_post.dir/step1_post.cc.o
[ 80%] Linking CXX shared library libmodelbox-unit-cpu-step1_post.so
[100%] Built target modelbox-unit-cpu-step1_post
Install the project...
-- Install configuration: "Debug"
-- Up-to-date: /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/etc/flowunit/cpp/libmodelbox-unit-cpu-draw_box.so.1.0.0
-- Up-to-date: /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/etc/flowunit/cpp/libmodelbox-unit-cpu-draw_box.so.1
-- Up-to-date: /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/etc/flowunit/cpp/libmodelbox-unit-cpu-draw_box.so
-- Installing: /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/etc/flowunit/cpp/libmodelbox-unit-cpu-step1_post.so.1.0.0
-- Up-to-date: /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/etc/flowunit/cpp/libmodelbox-unit-cpu-step1_post.so.1
-- Set runtime path of "/mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/etc/flowunit/cpp/libmodelbox-unit-cpu-step1_post.so.1.0.0" to ""
-- Up-to-date: /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/etc/flowunit/cpp/libmodelbox-unit-cpu-step1_post.so
dos2unix converting file /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/graph/modelbox.conf  to to Unix format...
dos2unix converting file /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/graph/video_test.toml  to to Unix format...
dos2unix converting file /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/model/face_phone_infer/face_phone_infer.toml  to to Unix format...
dos2unix converting file /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/bin/mock_task.toml  to to Unix format...

build success: you can run main.sh in ./bin folder

报错信息:

root@iTOP-RK3568:/mnt/mmc/zgm/modelbox/rk3568/workspace/video_test $ ./bin/main.sh
debain os need load libgomp
[2023-06-30 15:21:01,722][ WARN][    iva_config.cc:143 ] update vas url failed. Fault, no vas projectid or iva endpoint
[2023-06-30 15:21:01,723][ WARN][         timer.cc:208 ] Schedule timer failed, timer is not running.
[2023-06-30 15:21:03,161][ERROR][        driver.cc:347 ] dlopen /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/bin/../etc/flowunit/cpp/libmodelbox-unit-cpu-draw_box.so.1.0.0 failed, error: /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/bin/../etc/flowunit/cpp/libmodelbox-unit-cpu-draw_box.so.1.0.0: undefined symbol: _ZN2cv8fastFreeEPv
[2023-06-30 15:21:03,832][ WARN][flowunit_manager.cc:342 ] CreateFlowUnit: draw_box failed, code: Not found, errmsg: can not find flowunit [type: cpu, name:draw_box], Please check if the 'device' configured correctly or if the flowunit library exists.
[2023-06-30 15:21:03,833][ERROR][         graph.cc:644 ] code: Not found, errmsg: create flowunit 'draw_box' failed.
[2023-06-30 15:21:03,833][ERROR][          flow.cc:537 ] build graph failed, Not found, build graph failed, please check graph config. -> create flowunit 'draw_box' failed. -> can not find flowunit [type: cpu, name:draw_box], Please check if the 'device' configured correctly or if the flowunit library exists.
[2023-06-30 15:21:03,833][ERROR][   iva_manager.cc:192 ] IvaManager::Start: modelbox_job Build failed, ret: code: Not found, errmsg: build graph failed, please check graph config.
[2023-06-30 15:21:03,833][ERROR][    iva_plugin.cc:50  ] IvaPlugin start failed
[2023-06-30 15:21:03,833][ERROR][        server.cc:70  ] Plugin, start failed, /mnt/mmc/zgm/modelbox/rk3568/workspace/video_test/bin/../../../modelbox-rk-aarch64/lib/modelbox-iva-plugin.so
[2023-06-30 15:21:03,833][ERROR][          main.cc:242 ] server start failed !

draw_box 流单元:

MODELBOX_FLOWUNIT(draw_boxFlowUnit, desc) {
  /*set flowunit attributes*/
  desc.SetFlowUnitName(FLOWUNIT_NAME);
  desc.SetFlowUnitGroupType("Image");
  desc.AddFlowUnitInput(modelbox::FlowUnitInput("img_in", "cpu"));
  desc.AddFlowUnitInput(modelbox::FlowUnitInput("box_in", "cpu"));
  desc.AddFlowUnitOutput(modelbox::FlowUnitOutput("out"));
  desc.SetFlowType(modelbox::NORMAL);
  desc.SetDescription(FLOWUNIT_DESC);
  /*set flowunit parameter */
  desc.AddFlowUnitOption(modelbox::FlowUnitOption(
      "height", "int", true, "224", "model height"));
  desc.AddFlowUnitOption(modelbox::FlowUnitOption(
      "width", "int", true, "224", "model width"));
}

生成的库是存在的,设备也指定了,定位不到错误。

pymumu commented 1 year ago

初始化管理插件失败,

IvaManager::Start: modelbox_job Build failed, ret: code: Not found, errmsg: build graph failed, please check graph config.

你这个镜像从哪里获取的?

LostmanMing commented 1 year ago

初始化管理插件失败,

IvaManager::Start: modelbox_job Build failed, ret: code: Not found, errmsg: build graph failed, please check graph config.

你这个镜像从哪里获取的?

没用镜像,用的云平台上的SDKRK系列 ModelBox SDK 上面有个RK系列 ModelBox SDK

pymumu commented 1 year ago

这个要和modelarts配合才能运行,你可以先用modelbox-tool flow -run验证