云服务器内容精选

  • 创建边缘资源池 登录视频智能分析服务,在运维中心页面左侧导航栏中选择“边缘资源池”。 在“边缘资源池”页面,单击“创建边缘资源池”,参考表1配置相关参数。 表1 创建边缘运行池参数说明 字段 是否必填 类型 示例 参数说明 资源池名称 是 String edge-pool-001 只能由英文字母(a~z)、数字(0~9)、中划线(-)组成,长度范围为[4,32]。 描述 否 String - 输入长度范围为0到255个字符。 边缘节点 是 string edge-node-001 通过下拉框进行选择,来源于IEF平台纳管的边缘节点。 配置完成后,单击“提交”。系统自动跳转至边缘资源池列表页面。可在“边缘资源池”页面查看创建的边缘资源池信息。
  • 请求 请求样例1(摄像头输入+DIS/Webhook输出) POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-intrusiondetection-edge/tasks { "name": "intrusiondetection-edge-task", "description": "Intrusion task test", "input": { "type": "edgecamera", "data": [ { "id": "aec5857c-222f-4aa9-be39-23654e118886", "index": 0 } ] }, "output": { "dis": { "stream_name": "dis-intrusiondetection-edge" }, "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": { "car_detection_sw": 0, "person_detection_sw": 1, "detection_min_size": 60, "detection_max_size": 1080, "line_detection_sw": 1, "region_detection_sw": 1, "loitering_detection_sw": 0, "all_print_sw": 0, "target_roi": "{\"lines\":[{\"data\":[[560,680],[1185,506]],\"properties\":{\"side1_name\":\"Side1\",\"side2_name\":\"Side2\"}}],\"polygons\":[{\"data\":[[0,0],[0,1080],[1920,1080],[1920,0]]}]}", "image_compression_ratio":90, "render_result_sw": 1, "render_roi_sw": 1 } } } 请求样例2(edgerestful输入+DIS/Webhook输出) POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-intrusiondetection-edge/tasks { "name": "intrusiondetection-edge-task", "description": "Intrusion 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-surveillance-edge" }, "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": { "car_detection_sw": 0, "person_detection_sw": 1, "detection_min_size": 60, "detection_max_size": 1080, "line_detection_sw": 1, "region_detection_sw": 1, "loitering_detection_sw": 0, "all_print_sw": 0, "target_roi": "{\"lines\":[{\"data\":[[560,680],[1185,506]],\"properties\":{\"side1_name\":\"Side1\",\"side2_name\":\"Side2\"}}],\"polygons\":[{\"data\":[[0,0],[0,1080],[1920,1080],[1920,0]]}]}", "image_compression_ratio":90, "render_result_sw": 1, "render_roi_sw": 1 } } } 请求样例3(VCN输入+DIS/Webhook输出) POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-intrusiondetection-edge/tasks { "name": "surveillance-edge-task", "description": "Intrusion task test", "input": { "type": "vcn", "vcn":{ "ip":"172.100.119.6", "password":"CQeNfcRLwyMvH77AkDBaPS+BKXdFu/1bAXtIMNTx3QPbVewjipNq06nNodxWI28I1lCUsvv2+wB1joepzynLVW3g2nz0k9vaCRDoK6=", "port":"4675", "username":"testname" }, "data": [ { "index": 0, "stream_type": 1, "device_id":"07211540881586160101#f7964493ff764bbf9294d58b22e63de6" } ] }, "output": { "dis": { "stream_name": "dis-intrusiondetection-edge" }, "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": { "car_detection_sw": 0, "person_detection_sw": 1, "detection_min_size": 60, "detection_max_size": 1080, "line_detection_sw": 1, "region_detection_sw": 1, "loitering_detection_sw": 0, "all_print_sw": 0, "target_roi": "{\"lines\":[{\"data\":[[560,680],[1185,506]],\"properties\":{\"side1_name\":\"Side1\",\"side2_name\":\"Side2\"}}],\"polygons\":[{\"data\":[[0,0],[0,1080],[1920,1080],[1920,0]]}]}", "image_compression_ratio":90, "render_result_sw": 1, "render_roi_sw": 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 服务的算法配置,配置参数见service_config参数说明。 service_config中common参数说明 字段 是否必选 类型 说明 car_detection_sw 否 Int 对应控制台的界面参数“车检测开关”。 检测车开关: 0:表示不检测。 1:表示检测。 默认值为0。 person_detection_sw 否 Int 对应控制台的界面参数“人检测开关”。 检测人开关: 0:表示不检测。 1:表示检测。 默认值为1。 detection_min_size 否 Int 对应控制台的界面参数“检测目标最小像素值”。 检测目标的长宽最小像素值,取值范围为[60, 4000],默认值为60。 detection_max_size 否 Int 对应控制台的界面参数“检测目标最大像素值”。 检测目标的长宽最大像素值,取值范围为[640, 4000],默认值为1080。 line_detection_sw 否 Int 对应控制台的界面参数“过线检测开关”。 过线入侵检测开关: 0:表示关闭。 1:表示开启。 默认值为1。 region_detection_sw 否 Int 对应控制台的界面参数“区域检测开关”。 区域入侵检测开关: 0:表示关闭。 1:表示开启。 默认值为1。 loitering_detection_sw 否 Int 对应控制台的界面参数“徘徊检测开关”。 徘徊检测开关: 0:表示关闭。 1:表示开启。 默认值为0。检测范围与areaSetting区域设置一致。 target_roi 否 String 对应控制台的界面参数“检测区域设置”。 表示检测区域,该字段为JSON格式的字符串,API调用时需要加转义符。详细JSON格式参见target_roi(目标区域)。 例如: {"lines":[{"data":[[560,680],[1185,506]],"properties":{"side1_name":"Side1","side2_name":"Side2"}}],"polygons":[{"data":[[0,0],[0,1080],[1920,1080],[1920,0]]}]} 参数没有携带时,默认区域为整个视频帧。 直线与区域默认位置如图1所示。 image_compression_ratio 否 Int 对应控制台的界面参数“图片压缩比”。 图片压缩百分比,取值范围为[20,100]。 默认值:90,表示图片压缩比为90%。 render_result_sw 否 Int 对应控制台的界面参数“目标框渲染开关”。 输出图像是否绘制告警目标边框,取值范围: "0":表示不绘制; "1":表示用红色绘制告警目标边框。 默认值为0。 render_roi_sw 否 Int 对应控制台的界面参数“检测区域渲染开关”。 输出图像是否绘制检测区域,取值范围: "0":表示不绘制; "1":表示用黄色绘制用户设定区域。 默认值为0。 all_print_sw 否 Int 对应控制台的界面参数“全告警渲染开关”。 输出是否包含历史告警结果,取值范围: 0:表示关闭。 1:表示开启。 默认值为0。 当target_roi参数未设置时,直线与区域默认位置如图1所示,其中Wframe为帧宽度,Hframe为帧高度。 图1 直线与区域默认位置 直线两端点point_1与point_2默认值为: point_1=(¼Wframe, ½Hframe) point_2=(¾Wframe, ½Hframe) 默认区域为整个视频帧。
  • 请求 请求样例1(摄像头输入+DIS/Webhook输出) POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-intrusiondetection-edge/tasks{ "name": "intrusiondetection-edge-task", "description": "Intrusion task test", "input": { "type": "edgecamera", "data": [ { "id": "aec5857c-222f-4aa9-be39-23654e118886", "index": 0 } ] }, "output": { "dis": { "stream_name": "dis-intrusiondetection-edge" }, "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": { "car_detection_sw": 0, "person_detection_sw": 1, "detection_min_size": 60, "detection_max_size": 1080, "line_detection_sw": 1, "region_detection_sw": 1, "loitering_detection_sw": 0, "target_roi": "{\"lines\":[{\"data\":[[560,680],[1185,506]],\"properties\":{\"side1_name\":\"Side1\",\"side2_name\":\"Side2\"}}],\"polygons\":[{\"data\":[[0,0],[0,1080],[1920,1080],[1920,0]]}]}", "image_compression_ratio":90, "render_result_sw": 1, "render_roi_sw": 1 } }} 请求样例2(edgerestful输入+DIS/Webhook输出) POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-intrusiondetection-edge/tasks{ "name": "intrusiondetection-edge-task", "description": "Intrusion 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-surveillance-edge" }, "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": { "car_detection_sw": 0, "person_detection_sw": 1, "detection_min_size": 60, "detection_max_size": 1080, "line_detection_sw": 1, "region_detection_sw": 1, "loitering_detection_sw": 0, "target_roi": "{\"lines\":[{\"data\":[[560,680],[1185,506]],\"properties\":{\"side1_name\":\"Side1\",\"side2_name\":\"Side2\"}}],\"polygons\":[{\"data\":[[0,0],[0,1080],[1920,1080],[1920,0]]}]}", "image_compression_ratio":90, "render_result_sw": 1, "render_roi_sw": 1 } }} 请求样例3(VCN输入+DIS/Webhook输出) POST /v2/6204a5bd270343b5885144cf9c8c158d/services/c-intrusiondetection-edge/tasks{ "name": "surveillance-edge-task", "description": "Intrusion task test", "input": { "type": "vcn", "vcn":{ "ip":"172.100.119.6", "password":"CQeNfcRLwyMvH77AkDBaPS+BKXdFu/1bAXtIMNTx3QPbVewjipNq06nNodxWI28I1lCUsvv2+wB1joepzynLVW3g2nz0k9vaCRDoK6=", "port":"4675", "username":"testname" }, "data": [ { "index": 0, "stream_type": 1, "device_id":"07211540881586160101#f7964493ff764bbf9294d58b22e63de6" } ] }, "output": { "dis": { "stream_name": "dis-intrusiondetection-edge" }, "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": { "car_detection_sw": 0, "person_detection_sw": 1, "detection_min_size": 60, "detection_max_size": 1080, "line_detection_sw": 1, "region_detection_sw": 1, "loitering_detection_sw": 0, "target_roi": "{\"lines\":[{\"data\":[[560,680],[1185,506]],\"properties\":{\"side1_name\":\"Side1\",\"side2_name\":\"Side2\"}}],\"polygons\":[{\"data\":[[0,0],[0,1080],[1920,1080],[1920,0]]}]}", "image_compression_ratio":90, "render_result_sw": 1, "render_roi_sw": 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 服务的算法配置,配置参数见service_config参数说明。 service_config中common参数说明 字段 是否必选 类型 说明 car_detection_sw 否 Int 对应控制台的界面参数“车检测开关”。 检测车开关: 0:表示不检测。 1:表示检测。 默认值为0。 person_detection_sw 否 Int 对应控制台的界面参数“人检测开关”。 检测人开关: 0:表示不检测。 1:表示检测。 默认值为1。 detection_min_size 否 Int 对应控制台的界面参数“检测目标最小像素值”。 检测目标的长宽最小像素值,取值范围为[60, 4000],默认值为60。 detection_max_size 否 Int 对应控制台的界面参数“检测目标最大像素值”。 检测目标的长宽最大像素值,取值范围为[1080, 4000],默认值为1080。 line_detection_sw 否 Int 对应控制台的界面参数“过线检测开关”。 过线入侵检测开关: 0:表示关闭。 1:表示开启。 默认值为1。 region_detection_sw 否 Int 对应控制台的界面参数“区域检测开关”。 区域入侵检测开关: 0:表示关闭。 1:表示开启。 默认值为1。 loitering_detection_sw 否 Int 对应控制台的界面参数“徘徊检测开关”。 徘徊检测开关: 0:表示关闭。 1:表示开启。 默认值为0。检测范围与areaSetting区域设置一致。 target_roi 否 String 对应控制台的界面参数“检测区域设置”。 表示检测区域,该字段为JSON格式的字符串,API调用时需要加转义符。详细JSON格式参见target_roi(目标区域)。 例如: {"lines":[{"data":[[560,680],[1185,506]],"properties":{"side1_name":"Side1","side2_name":"Side2"}}],"polygons":[{"data":[[0,0],[0,1080],[1920,1080],[1920,0]]}]} 参数没有携带时,默认区域为整个视频帧。 直线与区域默认位置如图1所示。 image_compression_ratio 否 Int 对应控制台的界面参数“图片压缩比”。 图片压缩百分比,取值范围为[20,100]。 默认值:90,表示图片压缩比为90%。 render_result_sw 否 Int 对应控制台的界面参数“目标框渲染开关”。 输出图像是否绘制告警目标边框,取值范围: "0":表示不绘制; "1":表示用红色绘制告警目标边框。 默认值为0。 render_roi_sw 否 Int 对应控制台的界面参数“检测区域渲染开关”。 输出图像是否绘制检测区域,取值范围: "0":表示不绘制; "1":表示用黄色绘制用户设定区域。 默认值为0。 当target_roi参数未设置时,直线与区域默认位置如图1所示,其中Wframe为帧宽度,Hframe为帧高度。 图1 直线与区域默认位置 直线两端点point_1与point_2默认值为: point_1=(¼Wframe, ½Hframe) point_2=(¾Wframe, ½Hframe) 默认区域为整个视频帧。
  • 查看分析结果 作业运行成功后,CampusGo服务使用post请求将作业的运行结果,包括告警结构化数据和图片数据,以JSON数据流的形式输出到用户指定的Webhook URL。 例如运行Webhook Service中的示例脚本,将接收到的Webhook消息写在与脚本同目录的post.txt文件中。 算法输出的JSON结果示例如下,表示识别出视频中在指定区域有人入侵。 { "event_type":196609, "task_id":"a52a4de502664128a92ee914f54e5b9d", "stream_id":"00167440000000000101#1f1934154a774374a278ec3d32dbd468", "message_id":"C8F67CE2-9C2A-11EB-BBF6-0242AC110002", "timestamp":1618299313, "image_base64":"/9j/4AAQSkZJRgA...", "data":{ "event_set":[ { "bounding_box":{ "x":853, "y":450, "w":101, "h":161 }, "detection_id":"C8B3D3A6-9C2A-11EB-BBF6-0242AC110002", "category":0, "start_position":"in", "end_position":"in" } ] }} 表1 JSON结果字段解释 字段 说明 task_id 表示作业ID。 image_base64 以base64编码形式输出图片数据。 data data中的内容表示算法作业运行输出的识别结果。 bounding_box 告警输出对象的矩形框。 x:矩形框左上角横坐标 y:矩形框左上角纵坐标 w:矩形框宽度 h:矩形框高度 detection_id 告警目标对应的ID。 category 告警目标的类型: 0:人 1:车 2:其他 start_position 表示入侵开始位置: 如果是过线入侵,则是入侵开始所在线一侧的名字。 如果是区域入侵,则是“in”或者“out”。 in:表示入侵开始在区域里面。 out:表示入侵开始在区域外面。 end_position 表示入侵结束位置: 如果是过线入侵,则是入侵结束所在线一侧的名字。 如果是区域入侵,则是“in”或者“out”。 in:表示入侵结束在区域里面。 out:表示入侵结束在区域外面。 父主题: 使用边缘入侵检测算法