Skip to content
New issue

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

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

Already on GitHub? # to your account

人脸检测demo代码trt_face_detect.py内关于output_queue_size的逻辑的使用方法 #114

Open
QQiangren opened this issue May 10, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@QQiangren
Copy link

QQiangren commented May 10, 2024

trt_face_detect.py的代码片段 :

def process(self, task):
    input_queue = task.get_inputs()[0]
    output_queue_0 = task.get_outputs()[0]
    output_queue_size = len(task.get_outputs())
    if output_queue_size >= 2:
        output_queue_1 = task.get_outputs()[1]

    while not input_queue.empty():
        pkt = input_queue.get()
        if pkt.timestamp == Timestamp.EOF:
            self.eof_received_ = True
        if pkt.is_(VideoFrame):
            self.frame_cache_.put(pkt.get(VideoFrame))

    while self.frame_cache_.qsize(
    ) >= self.in_frame_num_ or self.eof_received_:
        out_frames, detect_result_list = self.inference()
        for idx, frame in enumerate(out_frames):
            pkt = Packet(frame)
            pkt.timestamp = frame.pts
            output_queue_0.put(pkt)

            if (output_queue_size >= 2):
                pkt = Packet(detect_result_list[idx])
                pkt.timestamp = frame.pts
                output_queue_1.put(pkt)

        if self.frame_cache_.empty():
            break

    if self.eof_received_:
        for key in task.get_outputs():
            task.get_outputs()[key].put(Packet.generate_eof_packet())
            Log.log_node(LogLevel.DEBUG, self.node_, "output stream",
                         "done")
        task.timestamp = Timestamp.DONE

    return ProcessResult.OK

代码中有个判断if (output_queue_size >= 2):
进入逻辑后,会对检测结果:detect_result_list进行额外输出。
但是我执行demo时并不能触发这个逻辑分支。请问做什么操作才能使output_queue_size>=2。额外输出一个关于检测结果的输出。
感谢

@JackLau1222 JackLau1222 added the help wanted Extra attention is needed label Nov 28, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants