bmf icon indicating copy to clipboard operation
bmf copied to clipboard

请问如何在一个graph内设置两个输出?

Open QQiangren opened this issue 9 months ago • 1 comments

运行人脸识别demo(trt_face_detect.py)把判断语句:if (output_queue_size >= 2):屏蔽掉,云溪谷会报错: [2024-05-11 04:09:39.784] [info] node:c_ffmpeg_encoder 3 scheduler 1 [2024-05-11 04:09:39.807] [error] node id:1 catch exception: KeyError: (1,) At: /root/bmf/lvyantest/tensorrt_post/trt_face_detect.py(226): process [2024-05-11 04:09:39.807] [error] node id:1 Process node failed, will exit. [2024-05-11 04:09:39.808] [info] node 1 got exception, close directly [2024-05-11 04:09:39.808] [info] schedule queue 0 start to join thread [2024-05-11 04:09:39.808] [error] node id:1 catch exception: KeyError: (1,)

At: /root/bmf/lvyantest/tensorrt_post/trt_face_detect_ok.py(226): process

[2024-05-11 04:09:39.808] [error] node id:1 Process node failed, will exit. Traceback (most recent call last): File "testtrt1.py", line 54, in main() File "testtrt1.py", line 50, in main video.run() File "/root/bmf/output/bmf/builder/bmf_stream.py", line 82, in run return self.node_.get_graph().run(self) File "/root/bmf/output/bmf/builder/bmf_graph.py", line 747, in run self.exec_graph_.close() File "/root/bmf/lvyantest/tensorrt_post/trt_face_detect_ok.py", line 226, in process output_queue_1 = task.get_outputs()[1] KeyError: 1 是否是graph内只设置了一个输出,但是trt_face_detect.py内逻辑输出了文本的输出。请问在graph内怎样设置才能正确输出两个结果。

我的graph代码如下: import time import tensorrt as trt import bmf.hml.hmp as mp from nms import NMS import PIL from PIL import Image

def main(): graph1 = graph({'dump_graph':1})

video = graph1.decode({
    "input_path": "./face.mp4",
    "video_params": {
       "hwaccel": "cuda",
    }
})["video"]

video = video.module("trt_face_detect", {
    "model_path": "./version-RFB-640.engine",
    "input_shapes": {
        "input": [1, 3, 480, 640]
    }}, entry="trt_face_detect_ok.trt_face_detect")

video = video.module("face_postprocess",
    entry="face_postprocess.face_postprocess")

video = video.encode(
    None, {
        "output_path": "./trt_out.mp4",
        "video_params": {
            "codec": "h264_nvenc",
            "bit_rate": 5000000,
            "max_fr": 30
        }
    }
    )


video.run()

if name == "main": main() 感谢!

QQiangren avatar May 11 '24 04:05 QQiangren

video = module("TWO_OUTPUT"...) stream1 = video.module(...) stream2 = video.module(...)

sfeiwong avatar May 22 '24 06:05 sfeiwong