本文为您介绍目标检测(objectdet)类目下的车辆违停检测DetectVehicleIllegalParking的语法及示例。
功能描述
车辆违停检测能力可通过检测图片中目标区域内是否有车辆停放。
应用场景
- 消防通道占用:通过检测消防通道区域是否有车辆,可以判断是否有车辆占用了消防通道。
- 出入口违停:检测停车场、商场、小区、园区出入口指定区域是否有车辆违停。
特色优势
- 方便改造部署:仅需提供图像即可检测判断。
- 支持多种角度:支持通过多种角度检测是否存在车辆违停。
接入指引
1. 注册阿里云账号:打开阿里云官网,在阿里云官网右上角,单击立即注册,按照操作提示完成账号注册。
2. 开通能力:请确保您已开通目标检测服务,若未开通服务请立即开通。
3. 创建AccessKey:请确保您已创建AccessKey,如果您使用的是子账号AccessKey,您需要给子账号赋予AliyunVIAPIFullAccess权限,具体操作,请参见RAM授权。
4. 在线调试(可选):您可以通过OpenAPI Explorer在线调试能力,查看完整的调用示例代码及SDK依赖信息,也可以下载完整的工程。
5. 开发接入步骤:
- 在SDK总览中选择您要接入使用的SDK语言。
- 在对应语言的SDK文档中找到AI类目为目标检测(objectdet)类目的SDK包进行安装。
- 参考文档中提供的示例代码进行适当修改后调用。
6. 客户端直接调用:该能力常用的客户端调用方式包括以下几种。
输入限制
- 图像格式:JPEG、JPG、PNG、BMP。
- 图像大小:不超过500 KB。
- 图像分辨率:大于20×20像素,小于800×800像素。
- URL地址中不能包含中文字符。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 | 
| Action | String | 是 | DetectVehicleIllegalParking | 要执行的操作。取值:DetectVehicleIllegalParking。 | 
| ImageURL | String | 是 | http://viapi-test.oss-cn-shanghai.aliyuncs.com/viapi-3.0domepic/objectdet/DetectVehicleIllegalParking/DetectVehicleIllegalParking2.jpg | 图像URL地址。推荐使用上海地域的OSS链接,对于文件在本地或者非上海地域OSS链接的情况,请参见文件URL处理。 | 
| RoadRegions | Array | 是 | 多个区域。格式为RoadRegion_1, RoadRegion_2, ..., RoadRegion_N。 | |
| RoadRegion | Array | 是 | 任意四边形的四个顶点的坐标X和Y,格式为 | |
| Point | Object | 是 | 四边形的顶点坐标。 | |
| X | Long | 是 | 400 | 坐标点的X值。 | 
| Y | Long | 是 | 400 | 坐标点的Y值。 | 
返回数据
| 名称 | 类型 | 示例值 | 描述 | 
| RequestId | String | DB882EDD-991A-5A0C-A19B-CC7C4BA65E35 | 请求ID。 | 
| Data | Object | 返回的结果数据内容。 | |
| Elements | Array of Element | 车辆检测框的集合。 | |
| Boxes | Array of Boxes | 检测框坐标,格式为 | |
| Left | Long | 413 | 矩形区域的左上角横轴坐标。 | 
| Top | Long | 138 | 矩形区域的左上角纵轴坐标。 | 
| Right | Long | 499 | 矩形区域的右下角横轴坐标。 | 
| Bottom | Long | 268 | 矩形区域的右下角纵轴坐标。 | 
| Score | Float | 0.9599609375 | 检测框的置信度,范围为 | 
| TypeName | String | vehicle | 检测框对应的物体。取值仅为 | 
| Id | Long | 1 | 检测框ID。 | 
| RegionIntersects | Array of RegionIntersect | 与各个给定区域相交集的车辆检测框对应的车辆特征。 例如,返回结果为 {"Ids":[1,3}, {"Ids":2,4} ],其中{"Ids":1,3}是与区域1相交集的车辆检测框的ID, {"Ids":2,4}是与区域2相交集的车辆检测框的ID。当车辆出现在给定区域内,说明存在车辆占道的情况。 除了RegionIntersects里包含的ID的检测框外,其它的检测框为区域外的检测框。 | |
| Ids | Array of Long | [1,2,3] | 与各个指定区域相交集的车辆检测框的多个ID。 例如,{"Ids":1,3}是与相应区域相交集的车辆检测框的IDs。 | 
SDK参考
阿里云视觉AI目标检测类目下的车辆违停检测能力推荐使用SDK调用,支持多种编程语言,调用时请选择AI类目为目标检测(objectdet)的SDK包,文件参数通过SDK调用可支持本地文件及任意URL,具体可参见SDK总览。
示例
请求示例
http(s)://objectdet.cn-shanghai.aliyuncs.com/?Action=DetectVehicleIllegalParking      //更多关于访问域名(Endpoint)信息,请参见:https://help.aliyun.com/document_detail/143103.html
&ImageURL=http://viapi-test.oss-cn-shanghai.aliyuncs.com/viapi-3.0domepic/objectdet/DetectVehicleIllegalParking/DetectVehicleIllegalParking2.jpg
&RoadRegions=[{"RoadRegion":[{"Point":{"X":400,"Y":400}}]}]
&公共请求参数正常返回示例
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<DetectVehicleIllegalParkingResponse>
    <RequestId>DB882EDD-991A-5A0C-A19B-CC7C4BA65E35</RequestId>
    <Data>
        <RegionIntersects>
            <Ids>1</Ids>
            <Ids>2</Ids>
            <Ids>3</Ids>
            <Ids>4</Ids>
            <Ids>5</Ids>
            <Ids>6</Ids>
            <Ids>7</Ids>
            <Ids>8</Ids>
            <Ids>10</Ids>
            <Ids>11</Ids>
        </RegionIntersects>
        <Elements>
            <Score>0.9599609375</Score>
            <TypeName>vehicle</TypeName>
            <Id>0</Id>
            <Boxes>
                <Left>413</Left>
                <Top>138</Top>
                <Right>499</Right>
                <Bottom>268</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.95751953125</Score>
            <TypeName>vehicle</TypeName>
            <Id>1</Id>
            <Boxes>
                <Left>146</Left>
                <Top>121</Top>
                <Right>371</Right>
                <Bottom>284</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.93310546875</Score>
            <TypeName>vehicle</TypeName>
            <Id>2</Id>
            <Boxes>
                <Left>54</Left>
                <Top>92</Top>
                <Right>164</Right>
                <Bottom>213</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.9326171875</Score>
            <TypeName>vehicle</TypeName>
            <Id>3</Id>
            <Boxes>
                <Left>94</Left>
                <Top>141</Top>
                <Right>171</Right>
                <Bottom>232</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.9150390625</Score>
            <TypeName>vehicle</TypeName>
            <Id>4</Id>
            <Boxes>
                <Left>303</Left>
                <Top>114</Top>
                <Right>430</Right>
                <Bottom>195</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.82080078125</Score>
            <TypeName>vehicle</TypeName>
            <Id>5</Id>
            <Boxes>
                <Left>14</Left>
                <Top>134</Top>
                <Right>32</Right>
                <Bottom>154</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.767578125</Score>
            <TypeName>vehicle</TypeName>
            <Id>6</Id>
            <Boxes>
                <Left>0</Left>
                <Top>132</Top>
                <Right>17</Right>
                <Bottom>151</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.767578125</Score>
            <TypeName>vehicle</TypeName>
            <Id>7</Id>
            <Boxes>
                <Left>37</Left>
                <Top>133</Top>
                <Right>56</Right>
                <Bottom>162</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.765625</Score>
            <TypeName>vehicle</TypeName>
            <Id>8</Id>
            <Boxes>
                <Left>27</Left>
                <Top>131</Top>
                <Right>55</Right>
                <Bottom>158</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.75341796875</Score>
            <TypeName>vehicle</TypeName>
            <Id>9</Id>
            <Boxes>
                <Left>408</Left>
                <Top>14</Top>
                <Right>499</Right>
                <Bottom>143</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.517578125</Score>
            <TypeName>vehicle</TypeName>
            <Id>10</Id>
            <Boxes>
                <Left>164</Left>
                <Top>130</Top>
                <Right>183</Right>
                <Bottom>144</Bottom>
            </Boxes>
        </Elements>
        <Elements>
            <Score>0.355712890625</Score>
            <TypeName>vehicle</TypeName>
            <Id>11</Id>
            <Boxes>
                <Left>1</Left>
                <Top>133</Top>
                <Right>31</Right>
                <Bottom>153</Bottom>
            </Boxes>
        </Elements>
    </Data>
</DetectVehicleIllegalParkingResponse>JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
  "RequestId" : "DB882EDD-991A-5A0C-A19B-CC7C4BA65E35",
  "Data" : {
    "RegionIntersects" : {
      "Ids" : [ 1, 2, 3, 4, 5, 6, 7, 8, 10, 11 ]
    },
    "Elements" : [ {
      "Score" : 0.9599609375,
      "TypeName" : "vehicle",
      "Id" : 0,
      "Boxes" : {
        "Left" : 413,
        "Top" : 138,
        "Right" : 499,
        "Bottom" : 268
      }
    }, {
      "Score" : 0.95751953125,
      "TypeName" : "vehicle",
      "Id" : 1,
      "Boxes" : {
        "Left" : 146,
        "Top" : 121,
        "Right" : 371,
        "Bottom" : 284
      }
    }, {
      "Score" : 0.93310546875,
      "TypeName" : "vehicle",
      "Id" : 2,
      "Boxes" : {
        "Left" : 54,
        "Top" : 92,
        "Right" : 164,
        "Bottom" : 213
      }
    }, {
      "Score" : 0.9326171875,
      "TypeName" : "vehicle",
      "Id" : 3,
      "Boxes" : {
        "Left" : 94,
        "Top" : 141,
        "Right" : 171,
        "Bottom" : 232
      }
    }, {
      "Score" : 0.9150390625,
      "TypeName" : "vehicle",
      "Id" : 4,
      "Boxes" : {
        "Left" : 303,
        "Top" : 114,
        "Right" : 430,
        "Bottom" : 195
      }
    }, {
      "Score" : 0.82080078125,
      "TypeName" : "vehicle",
      "Id" : 5,
      "Boxes" : {
        "Left" : 14,
        "Top" : 134,
        "Right" : 32,
        "Bottom" : 154
      }
    }, {
      "Score" : 0.767578125,
      "TypeName" : "vehicle",
      "Id" : 6,
      "Boxes" : {
        "Left" : 0,
        "Top" : 132,
        "Right" : 17,
        "Bottom" : 151
      }
    }, {
      "Score" : 0.767578125,
      "TypeName" : "vehicle",
      "Id" : 7,
      "Boxes" : {
        "Left" : 37,
        "Top" : 133,
        "Right" : 56,
        "Bottom" : 162
      }
    }, {
      "Score" : 0.765625,
      "TypeName" : "vehicle",
      "Id" : 8,
      "Boxes" : {
        "Left" : 27,
        "Top" : 131,
        "Right" : 55,
        "Bottom" : 158
      }
    }, {
      "Score" : 0.75341796875,
      "TypeName" : "vehicle",
      "Id" : 9,
      "Boxes" : {
        "Left" : 408,
        "Top" : 14,
        "Right" : 499,
        "Bottom" : 143
      }
    }, {
      "Score" : 0.517578125,
      "TypeName" : "vehicle",
      "Id" : 10,
      "Boxes" : {
        "Left" : 164,
        "Top" : 130,
        "Right" : 183,
        "Bottom" : 144
      }
    }, {
      "Score" : 0.355712890625,
      "TypeName" : "vehicle",
      "Id" : 11,
      "Boxes" : {
        "Left" : 1,
        "Top" : 133,
        "Right" : 31,
        "Bottom" : 153
      }
    } ]
  }
}错误码
关于车辆违停检测的错误码,详情请参见常见错误码。
安全声明
- 请确保上传的图片或文件来源符合相应的法律法规。
- 通过体验调试上传的临时文件有效期为1小时,在24小时后会被系统自动清理删除。