使用pipeline编排的方式,如何获取视频流id、帧号等数据
收藏回复举报
使用pipeline编排的方式,如何获取视频流id、帧号等数据
t('forum.solved') 已解决
新人帖
发表于2024-04-12 09:30:13
0 查看

按照官方例子,使用pipeline编排的方式可以实现了读取多路视频流并得到分析结果的功能,但是目前获得的结果数据只有检测的结果,无法确定检测结果是来源于哪个视频流以及具体视频流的哪一帧,请问我该如何获取这些信息呢?
版本信息如下:

CANN: 7.0RC1

mxVision: 5.0rc3

pipeline的内容如下:

{
    "inferofflinevideo": {
        "stream_config": {
            "deviceId": "0"
        },
        "mxpi_rtspsrc0": {
            "props": {
                "rtspUrl": "rtsp://192.168.75.251/live/test8",
                "channelId": "0",
                "fpsMode": "1"
            },
            "factory": "mxpi_rtspsrc",
            "next": "mxpi_videodecoder0"
        },
        "mxpi_rtspsrc1": {
            "props": {
                "rtspUrl": "rtsp://192.168.75.251/live/test7",
                "channelId": "1",
                 "fpsMode": "1"
            },
            "factory": "mxpi_rtspsrc",
            "next": "mxpi_videodecoder1"
        },
        "mxpi_rtspsrc2": {
            "props": {
                "rtspUrl": "rtsp://192.168.75.251/live/test6",
                "channelId": "2",
                 "fpsMode": "1"
            },
            "factory": "mxpi_rtspsrc",
            "next": "mxpi_videodecoder2"
        },
        "mxpi_rtspsrc3": {
            "props": {
                "rtspUrl": "rtsp://192.168.75.251/live/test5",
                "channelId": "3",
                 "fpsMode": "1"
            },
            "factory": "mxpi_rtspsrc",
            "next": "mxpi_videodecoder3"
        },
        "mxpi_rtspsrc4": {
            "props": {
                "rtspUrl": "rtsp://192.168.75.251/live/test4",
                "channelId": "4",
                 "fpsMode": "1"
            },
            "factory": "mxpi_rtspsrc",
            "next": "mxpi_videodecoder4"
        },
        "mxpi_rtspsrc5": {
            "props": {
                "rtspUrl": "rtsp://192.168.75.251/live/test3",
                "channelId": "5",
                 "fpsMode": "1"
            },
            "factory": "mxpi_rtspsrc",
            "next": "mxpi_videodecoder5"
        },
        "mxpi_rtspsrc6": {
            "props": {
                "rtspUrl": "rtsp://192.168.75.251/live/test2",
                "channelId": "6",
                 "fpsMode": "1"
            },
            "factory": "mxpi_rtspsrc",
            "next": "mxpi_videodecoder6"
        },
        "mxpi_rtspsrc7": {
            "props": {
                "rtspUrl": "rtsp://192.168.75.251/live/test1",
                "channelId": "7",
                 "fpsMode": "1"
            },
            "factory": "mxpi_rtspsrc",
            "next": "mxpi_videodecoder7"
        },
        "mxpi_videodecoder0": {
            "props": {
                "inputVideoFormat": "H264",
                "outputImageFormat": "YUV420SP_NV12",
                "deviceId": "0",
                "vdecChannelId": "0"
            },
            "factory": "mxpi_videodecoder",
            "next": "mxpi_skipframe0"
        },
        "mxpi_videodecoder1": {
            "props": {
                "inputVideoFormat": "H264",
                "outputImageFormat": "YUV420SP_NV12",
                "deviceId": "0",
                "vdecChannelId": "1"
            },
            "factory": "mxpi_videodecoder",
            "next": "mxpi_skipframe1"
        },
        "mxpi_videodecoder2": {
            "props": {
                "inputVideoFormat": "H264",
                "outputImageFormat": "YUV420SP_NV12",
                "deviceId": "0",
                "vdecChannelId": "2"
            },
            "factory": "mxpi_videodecoder",
            "next": "mxpi_skipframe2"
        },
        "mxpi_videodecoder3": {
            "props": {
                "inputVideoFormat": "H264",
                "outputImageFormat": "YUV420SP_NV12",
                "deviceId": "0",
                "vdecChannelId": "3"
            },
            "factory": "mxpi_videodecoder",
            "next": "mxpi_skipframe3"
        },
        "mxpi_videodecoder4": {
            "props": {
                "inputVideoFormat": "H264",
                "outputImageFormat": "YUV420SP_NV12",
                "deviceId": "0",
                "vdecChannelId": "4"
            },
            "factory": "mxpi_videodecoder",
            "next": "mxpi_skipframe4"
        },
        "mxpi_videodecoder5": {
            "props": {
                "inputVideoFormat": "H264",
                "outputImageFormat": "YUV420SP_NV12",
                "deviceId": "0",
                "vdecChannelId": "5"
            },
            "factory": "mxpi_videodecoder",
            "next": "mxpi_skipframe5"
        },
        "mxpi_videodecoder6": {
            "props": {
                "inputVideoFormat": "H264",
                "outputImageFormat": "YUV420SP_NV12",
                "deviceId": "0",
                "vdecChannelId": "6"
            },
            "factory": "mxpi_videodecoder",
            "next": "mxpi_skipframe6"
        },
        "mxpi_videodecoder7": {
            "props": {
                "inputVideoFormat": "H264",
                "outputImageFormat": "YUV420SP_NV12",
                "deviceId": "0",
                "vdecChannelId": "7"
            },
            "factory": "mxpi_videodecoder",
            "next": "mxpi_skipframe7"
        },
        "mxpi_skipframe0":{
            "factory":"mxpi_skipframe",
            "next":"mxpi_parallel2serial0:0",
            "props":{
                "frameNum":"2"
            }
        },
        "mxpi_skipframe1":{
            "factory":"mxpi_skipframe",
            "next":"mxpi_parallel2serial1:0",
            "props":{
                "frameNum":"2"
            }
        },
        "mxpi_skipframe2":{
            "factory":"mxpi_skipframe",
            "next":"mxpi_parallel2serial2:0",
            "props":{
                "frameNum":"2"
            }
        },
        "mxpi_skipframe3":{
            "factory":"mxpi_skipframe",
            "next":"mxpi_parallel2serial3:0",
            "props":{
                "frameNum":"2"
            }
        },
        "mxpi_skipframe4":{
            "factory":"mxpi_skipframe",
            "next":"mxpi_parallel2serial4:0",
            "props":{
                "frameNum":"2"
            }
        },
        "mxpi_skipframe5":{
            "factory":"mxpi_skipframe",
            "next":"mxpi_parallel2serial5:0",
            "props":{
                "frameNum":"2"
            }
        },
        "mxpi_skipframe6":{
            "factory":"mxpi_skipframe",
            "next":"mxpi_parallel2serial6:0",
            "props":{
                "frameNum":"2"
            }
        },
        "mxpi_skipframe7":{
            "factory":"mxpi_skipframe",
            "next":"mxpi_parallel2serial7:0",
            "props":{
                "frameNum":"2"
            }
        },
        "mxpi_parallel2serial0":{
            "factory":"mxpi_parallel2serial",
            "props":{
                "dataSource":"mxpi_videodecoder0"
            },
            "next":"mxpi_imageresize0"
        },
        "mxpi_parallel2serial1":{
            "factory":"mxpi_parallel2serial",
            "props":{
                "dataSource":"mxpi_videodecoder1"
            },
            "next":"mxpi_imageresize1"
        },
        "mxpi_parallel2serial2":{
            "factory":"mxpi_parallel2serial",
            "props":{
                "dataSource":"mxpi_videodecoder2"
            },
            "next":"mxpi_imageresize2"
        },
        "mxpi_parallel2serial3":{
            "factory":"mxpi_parallel2serial",
            "props":{
                "dataSource":"mxpi_videodecoder3"
            },
            "next":"mxpi_imageresize3"
        },
        "mxpi_parallel2serial4":{
            "factory":"mxpi_parallel2serial",
            "props":{
                "dataSource":"mxpi_videodecoder4"
            },
            "next":"mxpi_imageresize4"
        },
        "mxpi_parallel2serial5":{
            "factory":"mxpi_parallel2serial",
            "props":{
                "dataSource":"mxpi_videodecoder5"
            },
            "next":"mxpi_imageresize5"
        },
        "mxpi_parallel2serial6":{
            "factory":"mxpi_parallel2serial",
            "props":{
                "dataSource":"mxpi_videodecoder6"
            },
            "next":"mxpi_imageresize6"
        },
        "mxpi_parallel2serial7":{
            "factory":"mxpi_parallel2serial",
            "props":{
                "dataSource":"mxpi_videodecoder7"
            },
            "next":"mxpi_imageresize7"
        },
        "mxpi_imageresize0": {
            "props": {
                "dataSource": "mxpi_parallel2serial0",
                "resizeHeight": "640",
                "resizeWidth": "640",
                "deviceId": "0"
            },
            "factory": "mxpi_imageresize",
            "next": "queue0"
        },
        "mxpi_imageresize1": {
            "props": {
                "dataSource": "mxpi_parallel2serial1",
                "resizeHeight": "640",
                "resizeWidth": "640",
                "deviceId": "0"
            },
            "factory": "mxpi_imageresize",
            "next": "queue1"
        },
        "mxpi_imageresize2": {
            "props": {
                "dataSource": "mxpi_parallel2serial2",
                "resizeHeight": "640",
                "resizeWidth": "640",
                "deviceId": "0"
            },
            "factory": "mxpi_imageresize",
            "next": "queue2"
        },
        "mxpi_imageresize3": {
            "props": {
                "dataSource": "mxpi_parallel2serial3",
                "resizeHeight": "640",
                "resizeWidth": "640",
                "deviceId": "0"
            },
            "factory": "mxpi_imageresize",
            "next": "queue3"
        },
        "mxpi_imageresize4": {
            "props": {
                "dataSource": "mxpi_parallel2serial4",
                "resizeHeight": "640",
                "resizeWidth": "640",
                "deviceId": "0"
            },
            "factory": "mxpi_imageresize",
            "next": "queue4"
        },
        "mxpi_imageresize5": {
            "props": {
                "dataSource": "mxpi_parallel2serial5",
                "resizeHeight": "640",
                "resizeWidth": "640",
                "deviceId": "0"
            },
            "factory": "mxpi_imageresize",
            "next": "queue5"
        },
        "mxpi_imageresize6": {
            "props": {
                "dataSource": "mxpi_parallel2serial6",
                "resizeHeight": "640",
                "resizeWidth": "640",
                "deviceId": "0"
            },
            "factory": "mxpi_imageresize",
            "next": "queue6"
        },
        "mxpi_imageresize7": {
            "props": {
                "dataSource": "mxpi_parallel2serial7",
                "resizeHeight": "640",
                "resizeWidth": "640",
                "deviceId": "0"
            },
            "factory": "mxpi_imageresize",
            "next": "queue7"
        },
        "queue0":{
            "props":{
                "max-size-buffers":"500"
            },
            "factory":"queue",
            "next":"mxpi_modelinfer0"
        },
        "queue1":{
            "props":{
                "max-size-buffers":"500"
            },
            "factory":"queue",
            "next":"mxpi_modelinfer1"
        },
        "queue2":{
            "props":{
                "max-size-buffers":"500"
            },
            "factory":"queue",
            "next":"mxpi_modelinfer2"
        },
        "queue3":{
            "props":{
                "max-size-buffers":"500"
            },
            "factory":"queue",
            "next":"mxpi_modelinfer3"
        },
        "queue4":{
            "props":{
                "max-size-buffers":"500"
            },
            "factory":"queue",
            "next":"mxpi_modelinfer4"
        },
        "queue5":{
            "props":{
                "max-size-buffers":"500"
            },
            "factory":"queue",
            "next":"mxpi_modelinfer5"
        },
        "queue6":{
            "props":{
                "max-size-buffers":"500"
            },
            "factory":"queue",
            "next":"mxpi_modelinfer6"
        },
        "queue7":{
            "props":{
                "max-size-buffers":"500"
            },
            "factory":"queue",
            "next":"mxpi_modelinfer7"
        },
        "mxpi_modelinfer0": {
            "props": {
                "dataSource": "mxpi_imageresize0",
                "modelPath": "./models/yolov5/best_traffic3.om",
                "postProcessConfigPath": "./models/yolov5/yolov5_pt_bs4_fp32.cfg",
                "labelPath": "./models/yolov5/traffic.names",
                "postProcessLibPath": "libMpYOLOv5PostProcessor.so",
                "deviceId": "0"
            },
            "factory": "mxpi_modelinfer",
            "next": "mxpi_dataserialize0"
        },
        "mxpi_modelinfer1": {
            "props": {
                "dataSource": "mxpi_imageresize1",
                "modelPath": "./models/yolov5/best_traffic3.om",
                "postProcessConfigPath": "./models/yolov5/yolov5_pt_bs4_fp32.cfg",
                "labelPath": "./models/yolov5/traffic.names",
                "postProcessLibPath": "libMpYOLOv5PostProcessor.so",
                "deviceId": "0"
            },
            "factory": "mxpi_modelinfer",
            "next": "mxpi_dataserialize1"
        },
        "mxpi_modelinfer2": {
            "props": {
                "dataSource": "mxpi_imageresize2",
                "modelPath": "./models/yolov5/best_traffic3.om",
                "postProcessConfigPath": "./models/yolov5/yolov5_pt_bs4_fp32.cfg",
                "labelPath": "./models/yolov5/traffic.names",
                "postProcessLibPath": "libMpYOLOv5PostProcessor.so",
                "deviceId": "0"
            },
            "factory": "mxpi_modelinfer",
            "next": "mxpi_dataserialize2"
        },
        "mxpi_modelinfer3": {
            "props": {
                "dataSource": "mxpi_imageresize3",
                "modelPath": "./models/yolov5/best_traffic3.om",
                "postProcessConfigPath": "./models/yolov5/yolov5_pt_bs4_fp32.cfg",
                "labelPath": "./models/yolov5/traffic.names",
                "postProcessLibPath": "libMpYOLOv5PostProcessor.so",
                "deviceId": "0"
            },
            "factory": "mxpi_modelinfer",
            "next": "mxpi_dataserialize3"
        },
        "mxpi_modelinfer4": {
            "props": {
                "dataSource": "mxpi_imageresize4",
                "modelPath": "./models/yolov5/best_traffic3.om",
                "postProcessConfigPath": "./models/yolov5/yolov5_pt_bs4_fp32.cfg",
                "labelPath": "./models/yolov5/traffic.names",
                "postProcessLibPath": "libMpYOLOv5PostProcessor.so",
                "deviceId": "0"
            },
            "factory": "mxpi_modelinfer",
            "next": "mxpi_dataserialize4"
        },
        "mxpi_modelinfer5": {
            "props": {
                "dataSource": "mxpi_imageresize5",
                "modelPath": "./models/yolov5/best_traffic3.om",
                "postProcessConfigPath": "./models/yolov5/yolov5_pt_bs4_fp32.cfg",
                "labelPath": "./models/yolov5/traffic.names",
                "postProcessLibPath": "libMpYOLOv5PostProcessor.so",
                "deviceId": "0"
            },
            "factory": "mxpi_modelinfer",
            "next": "mxpi_dataserialize5"
        },
        "mxpi_modelinfer6": {
            "props": {
                "dataSource": "mxpi_imageresize6",
                "modelPath": "./models/yolov5/best_traffic3.om",
                "postProcessConfigPath": "./models/yolov5/yolov5_pt_bs4_fp32.cfg",
                "labelPath": "./models/yolov5/traffic.names",
                "postProcessLibPath": "libMpYOLOv5PostProcessor.so",
                "deviceId": "0"
            },
            "factory": "mxpi_modelinfer",
            "next": "mxpi_dataserialize6"
        },
        "mxpi_modelinfer7": {
            "props": {
                "dataSource": "mxpi_imageresize7",
                "modelPath": "./models/yolov5/best_traffic3.om",
                "postProcessConfigPath": "./models/yolov5/yolov5_pt_bs4_fp32.cfg",
                "labelPath": "./models/yolov5/traffic.names",
                "postProcessLibPath": "libMpYOLOv5PostProcessor.so",
                "deviceId": "0"
            },
            "factory": "mxpi_modelinfer",
            "next": "mxpi_dataserialize7"
        },
        "mxpi_dataserialize0": {
            "props": {
                "outputDataKeys": "mxpi_modelinfer0"
            },
            "factory": "mxpi_dataserialize",
            "next": "mxpi_parallel2serial8:0"
        },
        "mxpi_dataserialize1": {
            "props": {
                "outputDataKeys": "mxpi_modelinfer1"
            },
            "factory": "mxpi_dataserialize",
            "next": "mxpi_parallel2serial8:1"
        },
        "mxpi_dataserialize2": {
            "props": {
                "outputDataKeys": "mxpi_modelinfer2"
            },
            "factory": "mxpi_dataserialize",
            "next": "mxpi_parallel2serial8:2"
        },
        "mxpi_dataserialize3": {
            "props": {
                "outputDataKeys": "mxpi_modelinfer3"
            },
            "factory": "mxpi_dataserialize",
            "next": "mxpi_parallel2serial8:3"
        },
        "mxpi_dataserialize4": {
            "props": {
                "outputDataKeys": "mxpi_modelinfer4"
            },
            "factory": "mxpi_dataserialize",
            "next": "mxpi_parallel2serial8:4"
        },
        "mxpi_dataserialize5": {
            "props": {
                "outputDataKeys": "mxpi_modelinfer5"
            },
            "factory": "mxpi_dataserialize",
            "next": "mxpi_parallel2serial8:5"
        },
        "mxpi_dataserialize6": {
            "props": {
                "outputDataKeys": "mxpi_modelinfer6"
            },
            "factory": "mxpi_dataserialize",
            "next": "mxpi_parallel2serial8:6"
        },
        "mxpi_dataserialize7": {
            "props": {
                "outputDataKeys": "mxpi_modelinfer7"
            },
            "factory": "mxpi_dataserialize",
            "next": "mxpi_parallel2serial8:7"
        },
        "mxpi_parallel2serial8":{
            "factory":"mxpi_parallel2serial",
            "next":"appsink0"
        },
        "appsink0": {
            "props": {
                "blocksize": "409600000"
                },
            "factory": "appsink"
        }
    }
}

获得结果的部分代码如下:
cke_7931.png

我要发帖子