K230在同时使用H265编码与yolo进行检测时出现错误

Viewed 48

重现步骤

单独使用H265编码时或者yolo检测没有问题
2.一旦将二者结合,因为H265编码时YUV格式,所以我另外开了一个RGB平面格式来运行yolo推理
3.报错信息显示:两者的空间会冲突然后导致程序失败,我在想是不是因为H265编码是硬件编码而在硬件编码期间,使用软件yolo运行占用其空间导致冲突进而报错,有什么解决方案?

期待结果和实际结果

软硬件版本信息

错误日志

尝试解决过程

补充材料

2 Answers

您好,请给出代码

class yolov11:
"""YOLOv11模型封装类"""
def init(self):
self.display_mode = "hdmi"
self.rgb888p_size = [640, 480]
if self.display_mode == "hdmi":
self.display_size = [640, 480]
else:
self.display_size = [640, 480]

    # 初始化YOLO11实例
    self.yolo = YOLO11(
        task_type="detect",
        mode="video",
        kmodel_path="/data/best.kmodel",
        labels="person",
        rgb888p_size=self.rgb888p_size,
        model_input_size=[320,320],
        display_size=self.display_size,
        conf_thresh=0.7,
        nms_thresh=0.45,
        max_boxes_num=50,
        debug_mode=0
    )
    self.yolo.config_preprocess()

def img_frame(self, sensor):
    """获取传感器图像帧"""
    self.sensor = sensor
    frame = self.sensor.snapshot(chn=CAM_CHN_ID_2)
    input_np = frame.to_numpy_ref()
    return input_np

def yolo_run(self, sensor):
    """运行YOLO推理"""
    img = self.img_frame(sensor)
    res = self.yolo.run(img)
    return res

def destory(self):
    """释放资源"""
    self.pl.destory()    

def H265_Transform(self, client):
"""H265编码传输模式"""
self.H265_Start() # 确保编码器已启动
self.H265_send_frame(client)
self.encoder.ReleaseStream(VENC_CHN_ID_0, self.streamData)
下面两个是主函数运行的

self.H265_Transform(self.client_socket)
res = self.yolo.yolo_run(self.sensor)
报错信息,运行一会就会报错
程序被中断: sensor(0) snapshot chn(2) failed(-1609203696)