本文介绍外卖单识别RecognizeTakeoutOrder的语法及示例。
功能描述
外卖单识别能力可以识别外卖单上的关键字段内容,输出商店名称、电话、包装费、配送费、商品合计、其他费用合计、顾客优惠合计、总件数、在线支付、订单编号、下单时间等。目前支持饿了么外卖单。
前提条件
输入限制
- 图像格式:JPEG、JPG、PNG、BMP。
- 图像大小:不超过10 MB。
- 图像分辨率:不限制图片分辨率,但是分辨率太高可能会导致API推理超时,推理超时时间为5秒。
- URL地址中不能包含中文字符。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | RecognizeTakeoutOrder |
系统规定参数。取值:RecognizeTakeoutOrder。 |
ImageURL | String | 是 | http://viapi-test.oss-cn-shanghai.aliyuncs.com/viapi-3.0domepic/ocr/RecognizeTakeoutOrder/RecognizeTakeoutOrder1.jpg |
图像URL地址。当前仅支持上海地域的OSS链接,如何生成URL请参见生成URL。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | CFB676F0-45D9-520F-BB27-232B90409F87 |
请求ID。 |
Data | Object |
返回的结果数据内容。 |
|
Elements | Array of Element |
识别出的外卖单具体内容。 |
|
Value | String | 4.00 |
具体字段对应的内容。 |
Boxes | Array of Integer | [2177, 2082, 2321, 2152] |
字段位置框信息,格式为[左上角点X轴坐标,左上角点Y轴坐标,右上角点X轴坐标,右上角点Y轴坐标]。 |
Score | Float | 0.68 |
识别出的字段信息的置信度。 |
Name | String | delivery_fee |
外卖单上关键字段。包括:
|
示例
请求示例
http(s)://ocr.cn-shanghai.aliyuncs.com/?Action=RecognizeTakeoutOrder
&ImageURL=http://viapi-test.oss-cn-shanghai.aliyuncs.com/viapi-3.0domepic/ocr/RecognizeTakeoutOrder/RecognizeTakeoutOrder1.jpg
&<公共请求参数>
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<RecognizeTakeoutOrderResponse>
<RequestId>CFB676F0-45D9-520F-BB27-232B90409F87</RequestId>
<Data>
<Elements>
<Score>0.9995644688606262</Score>
<Value>4.00</Value>
<Name>delivery_fee</Name>
<Boxes>508</Boxes>
<Boxes>206</Boxes>
<Boxes>531</Boxes>
<Boxes>215</Boxes>
</Elements>
<Elements>
<Score>0.9991578459739685</Score>
<Value>0.00</Value>
<Name>packaging_fee</Name>
<Boxes>509</Boxes>
<Boxes>195</Boxes>
<Boxes>531</Boxes>
<Boxes>203</Boxes>
</Elements>
<Elements>
<Score>0.9390342831611633</Score>
<Value>起峰便利店(普迅中路店)</Value>
<Name>shop_name</Name>
<Boxes>386</Boxes>
<Boxes>52</Boxes>
<Boxes>486</Boxes>
<Boxes>61</Boxes>
</Elements>
<Elements>
<Score>0.9989892244338989</Score>
<Value>13588503737</Value>
<Name>telephone_number</Name>
<Boxes>386</Boxes>
<Boxes>62</Boxes>
<Boxes>437</Boxes>
<Boxes>69</Boxes>
</Elements>
<Elements>
<Score>0.9986419677734375</Score>
<Value>-2.00</Value>
<Name>total_benefits</Name>
<Boxes>504</Boxes>
<Boxes>252</Boxes>
<Boxes>531</Boxes>
<Boxes>260</Boxes>
</Elements>
<Elements>
<Score>0.9988936185836792</Score>
<Value>4.00</Value>
<Name>total_other</Name>
<Boxes>509</Boxes>
<Boxes>241</Boxes>
<Boxes>532</Boxes>
<Boxes>248</Boxes>
</Elements>
</Data>
</RecognizeTakeoutOrderResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "CFB676F0-45D9-520F-BB27-232B90409F87",
"Data" : {
"Elements" : [ {
"Score" : 0.9995644688606262,
"Value" : 4,
"Name" : "delivery_fee",
"Boxes" : [ 508, 206, 531, 215 ]
}, {
"Score" : 0.9991578459739685,
"Value" : 0,
"Name" : "packaging_fee",
"Boxes" : [ 509, 195, 531, 203 ]
}, {
"Score" : 0.9390342831611633,
"Value" : "起峰便利店(普迅中路店)",
"Name" : "shop_name",
"Boxes" : [ 386, 52, 486, 61 ]
}, {
"Score" : 0.9989892244338989,
"Value" : 13588503737,
"Name" : "telephone_number",
"Boxes" : [ 386, 62, 437, 69 ]
}, {
"Score" : 0.9986419677734375,
"Value" : -2,
"Name" : "total_benefits",
"Boxes" : [ 504, 252, 531, 260 ]
}, {
"Score" : 0.9988936185836792,
"Value" : 4,
"Name" : "total_other",
"Boxes" : [ 509, 241, 532, 248 ]
} ]
}
}
错误码
关于外卖单识别的错误码,详情请参见常见错误码。
SDK参考
阿里云视觉AI能力支持使用SDK调用,具体可参见SDK总览下载安装。
安全声明
- 请确保上传的图片或文件来源符合相应的法律法规。
- 通过体验调试上传的临时文件有效期为1小时,在24小时后会被系统自动清理删除。