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

创建边缘特殊车辆检测作业

功能介绍

该API可分析边缘摄像头输出的RTSP视频流,提供了特殊车辆检测、告警功能。给定场景位置信息,得到特殊车辆的坐标及车牌信息。

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

调试

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

URI

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

    参数

    是否必选

    类型

    说明

    project_id

    String

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

请求

  • 请求样例1(摄像头输入+DIS/Webhook输出)
    POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-specialvehicle-edge/tasks
    {
        "name": "specialvehicle-edge-task",
        "description": "Specialvehicle task test",
        "input": {
            "type": "edgecamera",
            "data": [
                {
                    "id": "aec5857c-222f-4aa9-be39-23654e118886",
                    "index": 0
                }
            ]
        },
        "output": {
            "dis": {
                "stream_name": "dis-campusgo"
            },
            "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": {
                  "video_start_time": "2019/04/14 08:00:00",
                  "road_lines":{
                    "lane_line_set":[
                      [460, 741, 241, 688],
                      [560, 841, 341, 788],
                      [660, 941, 441, 888]
                    ]
                  },
                  "license_plate":{
                    "local_city": "A",
                    "local_province": "津"
                  },
                  "spec_vehicle_type_set": [0,1,2,3],
                  "output_image": 1
            }
       }
    }
  • 请求样例2(edgerestful输入+DIS/Webhook输出)
    POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-specialvehicle-edge/tasks
    {
        "name": "specialvehicle-edge-task",
        "description": "Specialvehicle task test",
        "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-campusgo"
            },
            "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": {
                  "video_start_time": "2019/04/14 08:00:00",
                  "road_lines":{
                    "lane_line_set":[
                      [460, 741, 241, 688],
                      [560, 841, 341, 788],
                      [660, 941, 441, 888]
                    ]
                  },
                  "license_plate":{
                    "local_city": "A",
                    "local_province": "津"
                  },
                  "spec_vehicle_type_set": [0,1,2,3],
                  "output_image": 1
            }
       }
    }
  • 请求样例3(VCN输入+DIS/Webhook输出)
    POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-specialvehicle-edge/tasks
    {
        "name": "specialvehicle-edge-task",
        "description": "Specialvehicle task test",
        "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-campusgo"
            },
            "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": {
                  "video_start_time": "2019/04/14 08:00:00",
                  "road_lines":{
                    "lane_line_set":[
                      [460, 741, 241, 688],
                      [560, 841, 341, 788],
                      [660, 941, 441, 888]
                    ]
                  },
                  "license_plate":{
                    "local_city": "A",
                    "local_province": "津"
                  },
                  "spec_vehicle_type_set": [0,1,2,3],
                  "output_image": 1
            }
       }
    }
  • 参数说明

    参数

    是否必选

    类型

    说明

    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参数说明

    字段

    是否必选

    类型

    说明

    road_lines

    List

    道路线信息,其中

    lane_line_set:每条车道线的位置信息,格式为

    [[x1, y1, x2, y2],..., [x1, y1, x2, y2]],其中x1, y1, x2, y2依次表示车道线上端点坐标值和下端点坐标值

    license_plate

    List

    车牌信息

    local_city:城市简称。

    local_province:省份简称。

    spec_vehicle_type_set

    List

    检测的特殊车辆类型列表,属于该列表的特殊车辆会被检测并输出事件。

    MEDIUM_BUS 0 中巴。

    BIG_TANKER 1 罐车。

    BIG_TRUCK 2 大货车。

    BIG_BUS 3 大客车。

    output_image

    Int

    是否输出事件图片。

    1表示输出,0表示不输出,其他值非法。

响应

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

    参数

    类型

    说明

    id

    String

    作业ID。

检测结果

  • 输出JSON数据流到DIS指定的通道或者Webhook URL,包括告警结构化数据和图片数据。
  • JSON结果示例:
    {
         "output_id": 4,
         "scene_type": "special_vehicle",
         "stream_id": "03543400000000000101#1c471506397a48ecab0ba52360bdd430",
         "timestamp": 1555497378,
         "data": {
           "vehicle_set": [{
             "vehicle_box": {
               "x": 100,
               "y": 100,
               "w": 200,
               "h": 200
             },
             "vehicle_type": 2,
             "license_plate_id": "津B3XC4L"
           },{
             "vehicle_box": {
               "x": 200,
               "y": 200,
               "w": 400,
               "h": 400
             },
             "vehicle_type": 1,
             "license_plate_id": "津B3XD5R"
           }]
         },
         "image_base64": "base_64_code",
         "task_id": "61761681a6014e7c9024d642a0d4d412"
    }
  • JSON格式说明

    字段

    类型

    说明

    output_id

    Int

    输出类型编号,特殊车辆为4。

    scene_type

    String

    场景类型,"special_vehicle"。

    stream_id

    String

    摄像机ID,唯一表示;离线视频会输出视频名信息,区分不同的视频输出。

    timestamp

    Uint64

    检测到特殊车辆的时间戳。

    data

    List

    特殊车辆的输出信息字段集合,参见data参数格式说明。

    image_base64

    String

    图像的base64编码。

    task_id

    String

    作业ID。

  • data参数格式说明

    字段

    类型

    说明

    vehicle_set

    List

    特殊车辆的集合。

    vehicle_box

    String

    车辆的位置坐标信息,x,y依次表示车框左上角的坐标值,w,h表示车框的宽和高。

    vehicle_type

    Int

    特殊车辆的车辆类型。

    MEDIUM_BUS 0 中巴。

    BIG_TANKER 1 罐车。

    BIG_TRUCK 2 大货车。

    BIG_BUS 3 大客车。

    license_plate_id

    String

    特殊车辆的车牌内容。

返回值

  • 正常

    201

  • 异常

    返回值

    说明

    400 Bad Request

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

    401 Unauthorized

    鉴权失败。

    403 Forbidden

    没有操作权限。

    404 Not Found

    找不到资源。

    500 Internal Server Error

    服务内部错误。

    503 Service Unavailable

    服务不可用。

分享:

    相关文档

    相关产品