Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
QQiangren opened this issue May 11, 2024 · 1 comment
Open

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

QQiangren opened this issue May 11, 2024 · 1 comment

Comments

@QQiangren
Copy link

运行人脸识别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()
感谢!

@sfeiwong
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants