更新时间:2022-03-17 GMT+08:00
分享

创建消防通道占用检测

功能介绍

该API可分析边缘摄像头输出的RTSP视频流。提供了消防通道占用检测功能,可智能检测识别占用通道的堆物或车辆,同时上报占道堆物或者车辆(车牌较清晰情况下识别车牌号)告警。

目前支持H264、H265编码格式的RTSP视频流。

调试

您可以在API Explorer中调试该接口。

URI

  • URI格式
    POST /v2/{project_id}/services/c-fire-exit-occupation-edge/tasks
  • 参数说明

    参数

    是否必选

    类型

    说明

    project_id

    String

    服务所在区域对应的项目ID,获取方法请参见获取项目ID

请求

  • 请求样例1(摄像头输入+DIS/Webhook输出)
    POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-fire-exit-occupation-edge/tasks
    {
        "name": "fire-exit-occupation-edge_task",
        "description": "fire-exit-occupation-edge_task",
        "input": {
            "type": "edgecamera",
            "data": [
                {
                    "id": "9f8933c9-448c-48e5-8bc0-631ea83b92eb",
                    "index": 0
                }
            ]
        },
        "output": {
            "dis": {
                "stream_name": "dis-fire-exit-occupation"
            },
            "webhook": {
                "url": "https://apigw.huawei.com/api/event/callback",
                "headers": {
                    "content-type":"application/json"
                }
            }
        },
        "service_version": "3.0",
        "resource_order_id": "840a5cf90d4a4bbaa71f251dfe8fe64e",
        "edge_pool_id": "8dcf5ec7bc4d4a26aa1d3e1bb5ed2b5a",
        "service_config": {
            "common": {
                "image_compression_ratio": 90,
                "render_roi_sw": 1,
                "render_result_sw": 1,
                "stacking_occupation_sw": 1,
                "vehicle_occupation_sw": 1,
                "stacking_residence_time": 40,
                "vehicle_residence_time": 50,
                "target_roi": "{\"polygons\":[{\"data\":[[0, 0], [0, 1000], [1920, 1000], [1920, 0]]}]}"
            }
       }
    }
  • 请求样例2(edgerestful输入+DIS/Webhook输出)
    POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-fire-exit-occupation-edge/tasks
    {
        "name": "fire-exit-occupation-edge_task",
        "description": "fire-exit-occupation-edge_task",
        "input": {
            "type": "edgerestful",
            "data": [
                {
                    "index": 0,
                     "url":"https://100.127.134.69:554/test/data",
                    "certificate_check": false,
                    "rtsp_path_in_response": "data/url"
                }
            ]
        },
        "output": {
            "dis": {
                "stream_name": "dis-fire-exit-occupation"
            },
            "webhook": {
                "url": "https://apigw.huawei.com/api/event/callback",
                "headers": {
                    "content-type":"application/json"
                }
            }
        },
        "service_version": "3.0",
        "resource_order_id": "840a5cf90d4a4bbaa71f251dfe8fe64e",
        "edge_pool_id": "8dcf5ec7bc4d4a26aa1d3e1bb5ed2b5a",
        "service_config": {
            "common": {
                "image_compression_ratio": 90,
                "render_roi_sw": 1,
                "render_result_sw": 1,
                "stacking_occupation_sw": 1,
                "vehicle_occupation_sw": 1,
                "stacking_residence_time": 40,
                "vehicle_residence_time": 50,
                "target_roi": "{\"polygons\":[{\"data\":[[0, 0], [0, 1000], [1920, 1000], [1920, 0]]}]}"
            }
        }
    }
  • 请求样例3(VCN输入+DIS/Webhook输出)
    POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-fire-exit-occupation-edge/tasks
    {
        "name": "fire-exit-occupation-edge_task",
        "description": "fire-exit-occupation-edge_task",
        "input": {
            "type": "vcn",
            "vcn":{
                    "ip":"172.100.119.6",
                    "password":"CQeNfcRLwyMvH77AkDBaPS+BKXdFu/1bAXtIMNTx3QPbVewjipNq06nNodxWI28I1lCUsvv2+wB1joepzynLVW3g2nz0k9vaCRDoK6=",
                    "port":"4675",
                    "username":"testname"
            },
            "data": [
                {
                    "index": 0,
                    "device_id":"07211540881586160101#f7964493ff764bbf9294d58b22e63de6",
                    "stream_type":1
                }
            ]
        },
        "output": {
            "dis": {
                "stream_name": "dis-fire-exit-occupation"
            },
            "webhook": {
                "url": "https://apigw.huawei.com/api/event/callback",
                "headers": {
                    "content-type":"application/json"
                }
            }
        },
        "service_version": "3.0",
        "resource_order_id": "840a5cf90d4a4bbaa71f251dfe8fe64e",
        "edge_pool_id": "8dcf5ec7bc4d4a26aa1d3e1bb5ed2b5a",
        "service_config": {
            "common": {
                "image_compression_ratio": 90,
                "render_roi_sw": 1,
                "render_result_sw": 1,
                "stacking_occupation_sw": 1,
                "vehicle_occupation_sw": 0,
                "stacking_residence_time": 40,
                "vehicle_residence_time": 50,
                "target_roi": "{\"polygons\":[{\"data\":[[0, 0], [0, 1000], [1920, 1000], [1920, 0]]}]}"
            }
       }
    }
  • 参数说明

    参数

    是否必选

    类型

    说明

    name

    String

    作业名称,只能由中文、字母(a~zA~Z)、数字(0~9)、中划线(-)、下划线(_)组成,长度范围为[1,100]。

    description

    String

    作业描述信息,最大长度为500字符长度。

    input

    Object

    视频数据输入列表,支持从指定的边缘摄像头读取数据,即输入类型为“edgecamera”“edgerestful”“VCN”

    详细参数定义参见task.input(任务输入参数)

    service_version

    String

    功能版本号,版本号为3.0。边缘算法版本支持的显卡硬件为T4和华为自研Davinci芯片。

    resource_order_id

    String

    购买的算法能力包ID,在服务界面购买算法能力包获取。

    edge_pool_id

    String

    边缘运行池ID,获取方法参见创建边缘运行池

    output

    Object

    结果数据的输出列表,目前支持以下输出类型:
    • DIS:将结果输出到您指定的DIS通道 。
    • Webhook:将结果输出到Webhook URL。
    • Localpath:将作业的运行结果保存在边缘节点本地(节点必须为linux系统),必须为linux路径,例如“/opt/cloud/”

      详细参数定义见task.output(任务输出参数)

    service_config

    Object

    服务的算法配置,配置参数见ServiceConfig参数说明

  • service_config中common参数说明

    字段

    是否必选

    类型

    说明

    image_compression_ratio

    Int

    对应控制台的界面参数“图片压缩比”

    图片压缩百分比,取值范围为[20,100]。

    默认值:90,表示图片压缩比为90%。

    render_result_sw

    Int

    对应控制台的界面参数“目标框渲染开关”

    输出图像是否绘制告警目标边框,取值范围:

    • "0":表示不绘制。
    • "1":表示用红色绘制告警目标边框。

    默认值为0。

    render_roi_sw

    Int

    对应控制台的界面参数“检测区域渲染开关”

    输出图像是否绘制检测区域,取值范围:

    • "0":表示不绘制。
    • "1":表示用黄色绘制用户设定区域。

    默认值为0。

    stacking_occupation_sw

    Int

    对应控制台的界面参数“堆物占道检测开关”

    取值范围:

    • "0":表示不开启。
    • "1":表示开启。

    默认值为1。

    vehicle_occupation_sw

    Int

    对应控制台的界面参数“车辆占道检测开关”

    取值范围:

    • "0":表示不开启。
    • "1":表示开启。

    默认值为1。

    stacking_residence_time

    Int

    对应控制台的界面参数“堆物占道停留时间设置”。堆物在无明显遮挡的情况下停留时间超过该设置值则上报告警,其设置取值范围为[10, 3600],默认值为40,单位秒。

    vehicle_residence_time

    Int

    对应控制台的界面参数“车辆占道停留时间设置”。车辆在无明显遮挡的情况下停留时间超过该设置值则上报告警,其设置取值范围为[10, 3600],默认值为50,单位秒。

    target_roi

    String

    对应控制台的界面参数“检测区域设置”

    表示检测区域,该字段为JSON格式的字符串,API调用时需要加转义符。详细JSON格式参见target_roi(目标区域)

    例如:

    {"polygons":[{"data":[[84,389],[1840,349],[1824,526],[78,526]]}]}

    参数没有携带时,默认区域为整个视频帧。

响应

  • 响应样例
    [
      { 
        "id": "2f268b9472a544e991eae3c5c3534f5b"
      }
    ]
  • 返回作业ID列表

    参数

    类型

    说明

    id

    String

    作业ID。

检测结果

  • 输出JSON数据流到DIS指定的通道或者Webhook URL,包括告警结构化数据和图片数据。
  • JSON结果包括车辆占用消防通道报警以及堆物占用消防通道报警
    • 车辆占用消防通道报警json实例
      {
          "event_type": 1179649,
          "task_id": "a066974ae7334649a37257242c5fa4c3",
          "stream_id": "001",
          "timestamp": 1560346229,
          "message_id": "0DD1BEA6-634B-11E8-8B0B-407D0FAD9218",
          "image_base64":"/9j/4AAQSkZJRgA...",
           "data":{
               "event_set":[
                  {
                      "detection_id": "83BFC020-4FC8-11EA-9F93-0242AC110004",
                      "plate_id":"粤B7821E",
                      "bounding_box": {
                          "x":1712,
                          "y":560,
                          "w":207,
                          "h":180
                      }
                  }
              ]
          }
      }
    • 堆物占用消防通道报警json实例
      {
          "event_type": 1179648,
          "task_id": "a066974ae7334649a37257242c5fa4c3",
          "stream_id": "001",
          "timestamp": 1560346229,
          "message_id": "0DD1BEA6-634B-11E8-8B0B-407D0FAD9218",
          "image_base64":"/9j/4AAQSkZJRgA...",
           "data":{
               "event_set":[
                  {
                      "detection_id": "83BFC020-4FC8-11EA-9F93-0242AC110004",
                      "bounding_box": {
                          "x":679,
                          "y":376,
                          "w":483,
                          "h":342
                      }
                  }
              ]
          }
      }
    • JSON格式说明

      字段

      类型

      说明

      stream_id

      String

      摄像头编号。

      event_type

      Uint64

      快速标识消防通道占用检测的服务输出消息类型。

      • 堆物占用消防通道事件其值固定为1179648,对应16进制为 0x 0000 0000 0012 0000。
      • 车辆占用消防通道事件其值固定为1179649,对应16进制为 0x 0000 0000 0012 0001。

      task_id

      String

      作业ID。

      message_id

      String

      唯一标识本次输出消息的UUID。

      timestamp

      Uint64

      触发告警时间点的时间戳。

      image_base64

      String

      告警时刻输入的视频图像的Base64编码结果。

      data

      Object

      业务输出内容。

    • data参数格式说明

      字段

      类型

      说明

      event_set

      List<Object>

      输出事件列表。

    • event_set参数格式说明

      字段

      类型

      说明

      bounding_box

      Object

      告警输出对象的矩形框。

      detection_id

      String

      告警目标对应的UUID。画面中同一个占道区域,连续检测到的告警ID不变,若跟踪丢失ID会发生变化。

      plate_id

      String

      占道报警中车辆车牌号牌(7位或者8位)。仅当“车辆占道检测开关”vehicle_occupation_sw为1 时有该字段。

      需要注意的是由于车牌可能存在遮挡、花屏,模糊,若干字段相近等情况,导致车牌检测失败或者不准确,检测失败输出为空字符串。

    • bounding_box参数格式说明

      字段

      类型

      说明

      x

      Int

      矩形框左上角横坐标。

      y

      Int

      矩形框左上角纵坐标。

      w

      Int

      矩形框宽度。

      h

      Int

      矩形框高度。

返回值

  • 正常

    201

  • 异常

    返回值

    说明

    400 Bad Request

    请求错误,具体返回错误码请参考错误码

    401 Unauthorized

    鉴权失败。

    403 Forbidden

    没有操作权限。

    404 Not Found

    找不到资源。

    500 Internal Server Error

    服务内部错误。

    503 Service Unavailable

    服务不可用。

分享:

    相关文档

    相关产品