通用文字识别(增强版)
一、接口描述
1. 功能描述
基于业界领先的深度学习技术,利用光学字符识别技术,将图片上的文字转换为可编辑的文本。该版本支持多种场景图片的文字检测和识别,支持中英文、简繁体、标点符号、生僻字等识别
2. 接口数据要求:
- 图片格式:jpg、jpeg、png
- 图片大小:小于5M
3. 接口使用:
平台为每个API提供试用体验服务,您在AI市场选择“免费试用”规格下单后,即可开始体验业内领先的人工智能API服务。 免费试用服务具有调用量、QPS限制,如需更高性能的API服务,可以提交咨询工单,联系京东AI扩容购买。
在获得使用权限后,您可使用已经封装好的SDK/参照接口鉴权规则进行相应开发,整体流程详见 接入流程
二、请求说明
1. 接口地址 :
https://aiapi.jd.com/jdai/general_ocr
2. 请求方式:
POST
3. 请求参数
(1)query请求参数
公共请求参数
名称 | 类型 | 必填 | 示例值 | 描述 |
---|---|---|---|---|
appkey | String | 是 | 80d2b762ecb86593f9668526920f46c | 您的appkey,可在买家中心控制台中获取 |
timestamp | long | 是 | 1541491668060 | 请求的时间戳,精确到毫秒,timestamp有效期5分钟 |
sign | String | 是 | 2e148773a0337a8f2200ba90d445f083 | 签名,根据规则MD5(sectetkey+timestamp) |
(2)header请求参数
名称 | 类型 | 必填 | 示例值 | 描述 |
---|---|---|---|---|
Content-Type | String | 是 | application/json | 标准编码格式 |
(3)body请求参数(二选一)
名称 | 类型 | 必填 | 示例值 | 描述 |
---|---|---|---|---|
imageUrl | String | 是 | imageUrl=https://img10.360buyimg.com/n1/.....a43.jpg | 完整图片url |
imageBase64Str | String | 是 | imageBase64Str=/9j/4AAQSk... | 图片base64编码 |
4、请求代码示例
建议您使用我们提供的SDK进行调用,SDK获取及调用方式详见本页一接口描述中的4接口使用
三、返回说明
1、返回参数
(1)公共返回参数
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
code | string | 1000 | 参见下方错误码-系统级错误码 |
charge | boolean | false 或 true | false:不扣费, true:扣费 |
remainTimes | long | 1305 | 剩余调用次数;免费api:每天剩余调用次数;收费api:剩余次数;无限制时为-1 |
remainSeconds | long | 1223456 | 剩余调用时间(s);免费api:-1;收费api:剩余调用时间;无限制时为-1 |
msg | string | 查询成功 | 参见下方错误码-系统级错误码 |
result | object | {...} | 查询结果 |
(2)业务返回参数
result参数信息
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
code | int | 0 | 参照四、错误码-业务错误码 |
message | string | success | 状态码描述 |
request_id | string | cb4f53b8c60e9589445cc4cd895cf5b6 | 为方便定位问题的32位uuid |
resultData | object | {...} | 返回识别结果 |
resultData参数信息
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
probility | float | 0.00003642699 | 置信度 |
location | String | {"x":151,"width":90,"y":72,"heigth":30} | 检测区域 |
text | String | 经济实惠 | 识别结果 |
2、返回示例
{
"code": 0,
"resultData": [
{
"probility": 0.00003642699,
"location": {
"x": 179,
"width": 432,
"y": 367,
"height": 13
},
"text": "数据来源:SGS报:SHES150600318501-FOREO LUNA IPX-7 FOREO INC"
},
{
"probility": 0.99757713,
"location": {
"x": 175,
"width": 449,
"y": 71,
"height": 34
},
"text": "每一处小细节体现人性化设计"
},
{
"probility": 0.9386798,
"location": {
"x": 596,
"width": 161,
"y": 282,
"height": 19
},
"text": "品牌信誉优质服务"
},
{
"probility": 0.99653083,
"location": {
"x": 188,
"width": 111,
"y": 257,
"height": 19
},
"text": "12档强度调节"
},
{
"probility": 0.99964404,
"location": {
"x": 346,
"width": 88,
"y": 281,
"height": 19
},
"text": "使用450次"
},
{
"probility": 0.99839586,
"location": {
"x": 192,
"width": 99,
"y": 282,
"height": 18
},
"text": "减少不适感"
},
{
"probility": 0.9993311,
"location": {
"x": 490,
"width": 96,
"y": 281,
"height": 20
},
"text": "安全防水"
},
{
"probility": 0.99016434,
"location": {
"x": 490,
"width": 84,
"y": 257,
"height": 20
},
"text": "7级*保障"
},
{
"probility": 0.99964345,
"location": {
"x": 63,
"width": 80,
"y": 281,
"height": 20
},
"text": "不换刷头"
},
{
"probility": 0.89425755,
"location": {
"x": 205,
"width": 65,
"y": 174,
"height": 39
},
"text": "十-"
},
{
"probility": 0.96294105,
"location": {
"x": 621,
"width": 109,
"y": 258,
"height": 19
},
"text": "2年免费质保"
},
{
"probility": 0.9995945,
"location": {
"x": 346,
"width": 85,
"y": 257,
"height": 20
},
"text": "1小时充电"
},
{
"probility": 0.9998901,
"location": {
"x": 63,
"width": 77,
"y": 257,
"height": 20
},
"text": "经济实惠"
}
],
"message": "success",
"request_id": "815774d6ed6ca43e5d0cce316d36d822"
}
四、错误码
1.系统级错误码
2.业务错误码
业务错误码(code) | 对应message | 说明 |
---|---|---|
12001 | "image does not exist" | 图像不存在 |
12002 | "image format error" | 图像格式错误 |
12003 | "image size error" | 图像大小错误 |
12004 | "parameter does not exit" | 参数不存在 |
12005 | "parameter value is null" | 参数值为null |
13002 | "time out" | 超时 |
13004 | "no content recognition" | 无内容识别 |
13005 | "internel error" | 内部错误 |