搜索本产品文档关键词
API文档
所有文档
menu

文字识别

API文档

在线调试

您可以在 示例代码中心 中调试该接口,可进行签名验证、查看在线调用的请求内容和返回结果、示例代码的自动生成。

请求说明

请求示例

HTTP 方法:POST

请求URL: https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance

URL参数:

参数
access_token 通过API Key和Secret Key获取的access_token,参考“Access Token获取

Header如下:

参数
Content-Type application/x-www-form-urlencoded

Body中放置请求参数,参数详情如下:

请求参数

参数
是否必选
类型
可选值范围
说明
image 和 url/pdf_file 三选一 string - 图像数据,base64编码后进行urlencode,需去掉编码头(data:image/jpeg;base64, )
要求base64编码和urlencode后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/jpeg/png/bmp格式
url 和 image/pdf_file 三选一 string - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/jpeg/png/bmp格式,当image字段存在时url字段失效
请注意关闭URL防盗链
pdf_file 和 image/url 三选一 string - PDF文件,base64编码后进行urlencode,需去掉编码头(data:application/pdf;base64, )
要求base64编码和urlencode后大小不超过4M
注:目前仅支持单页PDF识别,如上传的为多页PDF,仅识别第一页
templateSign string - 模板 ID,自定义模板或预置模板的唯一标示,可用于调用指定的识别模板进行结构化识别,可在「模板管理」页查看并复制使用
classifierId string - 分类器Id,分类器的唯一标示,可用于调用指定的分类器对传入的图片进行自动分类及识别
与 templateSign 至少存在一个,如同时存在,则优先级 templateSign > classfierId

请求代码示例

提示一:使用示例代码前,请记得替换其中的示例Token、图片地址或Base64信息。

提示二:部分语言依赖的类或库,请在代码注释中查看下载地址。

1# 请求模板id
2curl -i -k 'https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance?access_token=【调用鉴权接口获取的token】' --data 'templateSign=xxx&image=【图片Base64编码,需UrlEncode】' -H 'Content-Type:application/x-www-form-urlencoded'
3# 请求分类器id
4curl -i -k 'https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance?access_token=【调用鉴权接口获取的token】' --data 'classifierId=xxx&image=【图片Base64编码,需UrlEncode】' -H 'Content-Type:application/x-www-form-urlencoded'
1# -*- coding:UTF-8 -*-
2# -*- encoding: utf-8 -*-
3import base64
4import requests
5
6if sys.version_info.major == 2:
7    from urllib import quote
8else:
9    from urllib.parse import quote
10
11
12headers = {
13        'Content-Type': "application/x-www-form-urlencoded",
14        'charset': "utf-8"
15    }
16if __name__ == '__main__':
17    # 代码中所需的工具包requests
18    # 安装方式:pip install requests
19    # iocr识别api_url
20    recognise_api_url = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance"
21
22
23    access_token = "your_access_token"
24    templateSign = "your_templateSign"
25    detectorId = 0
26    classifierId = "your_classifier_id"
27    # 测试数据路径
28    image_path = "your_file_path"
29    try:
30        with open(image_path, 'rb') as f:
31            image_data = f.read()
32        
33        if sys.version_info.major == 2:
34            image_b64 = base64.b64encode(image_data).replace("\r", "")
35        else:
36            image_b64 = base64.b64encode(image_data).decode().replace("\r", "")
37        
38        # 请求模板的bodys
39        recognise_bodys = "access_token=" + access_token + "&templateSign=" + templateSign + \
40                "&image=" + quote(image_b64.encode("utf8"))
41        # 请求分类器的bodys
42        classifier_bodys = "access_token=" + access_token + "&classifierId=" + classifierId + \
43                "&image=" + quote(image_b64.encode("utf8"))
44        # 请求模板识别
45        response = requests.post(recognise_api_url, data=recognise_bodys, headers=headers)
46        # 请求分类器识别
47        # response = requests.post(recognise_api_url, data=classifier_bodys, headers=headers)
48        print response.text
49    except Exception as e:
50        print e
1package com.baidu.ocr;
2
3import com.baidu.ai.aip.utils.Base64Util;
4import com.baidu.ai.aip.utils.FileUtil;
5import com.baidu.ai.aip.utils.HttpUtil;
6
7
8public class App 
9{
10    public static void main(String[] args) throws Exception
11    {
12        /**
13         * 重要提示代码中所需工具类
14         * FileUtil,Base64Util,HttpUtil,GsonUtils请从
15         * https://ai.baidu.com/file/658A35ABAB2D404FBF903F64D47C1F72
16         * https://ai.baidu.com/file/C8D81F3301E24D2892968F09AE1AD6E2
17         * https://ai.baidu.com/file/544D677F5D4E4F17B4122FBD60DB82B3
18         * https://ai.baidu.com/file/470B3ACCA3FE43788B5A963BF0B625F3
19         * 下载
20         */
21        // iocr识别apiUrl
22        String recogniseUrl = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance";
23
24
25        String filePath = "path\to\your\image.jpg";
26        try {
27                byte[] imgData = FileUtil.readFileByBytes(filePath);
28                String imgStr = Base64Util.encode(imgData);
29                // 请求模板参数
30                String recogniseParams = "templateSign=your_template_sign&image=" + URLEncoder.encode(imgStr, "UTF-8");
31                // 请求分类器参数
32                String classifierParams = "classifierId=your_classfier_id&image=" + URLEncoder.encode(imgStr, "UTF-8");
33                
34                
35                String accessToken = "your_access_token";
36                // 请求模板识别
37                String result = HttpUtil.post(recogniseUrl, accessToken, recogniseParams);
38                // 请求分类器识别
39                // String result = HttpUtil.post(recogniseUrl, accessToken, classifierParams);
40                
41                System.out.println(result);
42        } catch (Exception e) {
43                e.printStackTrace();
44        }
45    }
46}
1#include <iostream>
2#include "curl_install/include/curl/curl.h"
3#include <fstream>
4#include "Base64.h"
5#include <cctype>
6#include <iomanip>
7#include <sstream>
8#include <string>
9
10using namespace std;
11// libcurl库下载链接:https://curl.haxx.se/download.html
12// 通用iocr的接口url
13static string ocr_result;
14/**
15 * curl发送http请求调用的回调函数,回调函数中对返回的json格式的body进行了解析,解析结果储存在全局的静态变量当中
16 * @param 参数定义见libcurl文档
17 * @return 返回值定义见libcurl文档
18 */
19static size_t callback(void *ptr, size_t size, size_t nmemb, void *stream) {
20    // 获取到的body存放在ptr中,先将其转换为string格式
21    ocr_result = string((char *) ptr, size * nmemb);
22    return size * nmemb;
23}
24
25string url_encode(const std::string &value) {
26    ostringstream escaped;
27    escaped.fill('0');
28    escaped << hex;
29    for (std::string::const_iterator i = value.begin(), n = value.end(); i != n; ++i) {
30        std::string::value_type c = (*i);
31        // Keep alphanumeric and other accepted characters intact
32        if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
33            escaped << c;
34            continue;
35        }
36        // Any other characters are percent-encoded
37        escaped << uppercase;
38        escaped << '%' << setw(2) << int((unsigned char) c);
39        escaped << nouppercase;
40    }
41
42    return escaped.str();
43}
44// base64.h下载地址
45// https://bj.bcebos.com/v1/iocr-movie/Base64.h
46int iocr_regenize(const std::string &image_base64, const std::string &access_token, const std::string &templateSign, 
47    const std::int classifierId, const std::int detectorId) {
48    // iocr识别apiUrl
49    const static string recognise_api_url = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance";
50    // 请求模板的参数
51    std::string recognise_params = "access_token=" + access_token + "&templateSign=" + templateSign + "&image=" + image_base64;
52
53    // 请求分类器的参数
54    std::string classifier_params = "access_token=" + access_token 
55        + "&classifierId=" + std::to_string(classifierId) 
56        + "&image=" + image_base64;
57    
58    struct curl_slist * headers = NULL;
59    headers = curl_slist_append(headers, "Content-Type:application/x-www-form-urlencoded");
60    headers = curl_slist_append(headers, "charset:utf-8");
61    CURL *curl;
62    CURLcode result_code;
63    int is_success;
64    curl = curl_easy_init();
65    if (curl) {
66        // 使用libcurl post数据:设定待post的url等
67        curl_easy_setopt(curl, CURLOPT_URL, recognise_api_url.c_str());
68        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
69        curl_easy_setopt(curl, CURLOPT_POST, 1);
70        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, false);
71        curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,callback);
72        // 请求模板
73        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, recognise_params.c_str());
74        curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, recognise_params.size());
75        // 请求分类器
76        // curl_easy_setopt(curl, CURLOPT_POSTFIELDS, classifier_params.c_str());
77        // curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, classifier_params.size());
78        result_code = curl_easy_perform(curl);
79        // http post不成功时错误处理
80        if (result_code != CURLE_OK) {
81            fprintf(stderr, "curl_easy_perform() failed: %s\n",
82                    curl_easy_strerror(result_code));
83            is_success = 1;
84            return is_success;
85        }
86        curl_easy_cleanup(curl);
87        curl_slist_free_all(headers);
88        // 控制台输出识别结果
89        cout << ocr_result << endl;
90        is_success = 0;
91    } else {
92        fprintf(stderr, "curl_easy_init() failed.");
93        is_success = 1;
94    }
95    return is_success;
96}
97
98std::string get_image_b64(const std::string &image_path) {
99    ifstream f;
100    f.open(image_path, ios::in | ios::binary);
101    // 定位指针到文件末尾
102    f.seekg(0, ios::end);
103    int size = f.tellg();
104    // 指针重新回到文件头部
105    f.seekg(0, ios::beg);
106    char* buffer = (char*)malloc(sizeof(char)*size);
107    f.read(buffer,size);
108    f.close();
109    // base64编码
110    std::string image_b64 = base64_encode(buffer, size);
111    return image_b64;
112}
113
114int main() {
115    std::string access_token = "your_access_token";
116    std::string image_path = "your_file_path";
117    std::string templateSign = "your_templateSign";
118    std::int classifierId = "your_classifier_id";
119    std::int detectorId = 0;
120    // 获取本地图片的base64
121    std::string image_b64 = get_image_b64(image_path);
122    // urlcode编码
123    image_b64 = url_encode(image_b64);
124    // 发送post请求
125    iocr_regenize(image_b64, access_token, templateSign, classifierId, detectorId);
126    return 0;
127}
1<?php
2/**
3 * 发起http post请求(REST API), 并获取REST请求的结果
4 * @param string $url
5 * @param string $param
6 * @return - http response body if succeeds, else false.
7 */
8function request_post($url = '', $params = '')
9{
10    if (empty($url) || empty($params)) {
11        return false;
12    }
13    $headers = array("Content-Type" => "application/x-www-form-urlencoded", "charset" => "utf-8");
14    // 初始化curl
15    $curl = curl_init();
16    curl_setopt($curl, CURLOPT_URL, $url);
17    curl_setopt($curl, CURLOPT_HEADER, 0);
18    // 要求结果为字符串且输出到屏幕上
19    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
20    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
21    // post提交方式
22    //curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
23    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
24    curl_setopt($curl, CURLOPT_POST, 1);
25    curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
26    // 运行curl
27    $data = curl_exec($curl);
28    curl_close($curl);
29
30    return $data;
31}
32
33function get_image_b64($image_path = '')
34{
35    $image_b64 = '';
36    if(file_exists($image_path)) {
37        $image_data = file_get_contents($image_path);
38        print("file exists\n");
39        $image_b64_tmp = base64_encode($image_data);
40        $image_b64 = urlencode($image_b64_tmp);
41        //print($image_b64);
42    } else {
43        print("file doesn't exists\n");
44    }
45    return $image_b64;
46}
47// iocr识别api_url
48$recognise_api_url = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance";
49
50
51$access_token = "your_access_token";
52$templateSign = "your_templateSign";
53$detectorId = 0;
54$classifierId = "your_classifier_id";
55$image_path = "your_file_path";
56$image_b64 = get_image_b64($image_path);
57// iocr识别bodys
58$recognise_bodys = "access_token=". $access_token. "&templateSign=". $templateSign. "&image=". $image_b64;
59# 分类器请求的bodys
60$classifier_bodys = "access_token=". $access_token. "&classifierId=". $classifierId. "&image=". $image_b64;
61# 请求模板
62$response = request_post($recognise_api_url, $recognise_bodys);
63# 请求分类器
64# $response = request_post($recognise_api_url, $classifier_bodys);
65
66var_dump($response)
67?>
1using System;
2using System.Net;
3using System.IO;
4using System.Text;
5using System.Web;
6
7namespace iocr_api_demo
8{
9    class IocrApiDemo
10    {
11        static void Main(String[] args)
12        {
13            PostHttp();
14        }
15        public static void PostHttp(){
16            // fileUtils.cs 类下载地址
17            // https://bj.bcebos.com/v1/iocr-movie/FileUtils.cs
18            // iocr识别api_url
19            String recognise_api_url = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance";
20            
21            String access_token = "your_access_token";
22            String image_path = "your_file_path";
23            String image_b64 = FileUtils.getFileBase64(image_path);
24            // iocr按模板id识别的请求bodys
25            string templateSign = "yout_templateSign";
26            string recognise_bodys = "access_token=" + access_token + "&templateSign=" + templateSign + 
27                            "&image=" + HttpUtility.UrlEncode(image_b64);
28            // iocr按分类器id识别的请求bodys
29            int classifierId = "your_classifier_id";
30            String classifier_bodys = "access_token=" + access_token + "&classifierId=" + classifierId + "&image=" + HttpUtility.UrlEncode(image_b64);
31
32            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(recognise_api_url);
33            httpWebRequest.ContentType = "application/x-www-form-urlencoded";
34            httpWebRequest.Method = "POST";
35            httpWebRequest.KeepAlive = true;
36            try{
37                // 请求模板id
38                byte[] btBodys = Encoding.UTF8.GetBytes(recognise_bodys);
39                // 请求分类器id
40                // byte[] btBodys = Encoding.UTF8.GetBytes(classifier_bodys);
41                httpWebRequest.ContentLength = btBodys.Length;
42                httpWebRequest.GetRequestStream().Write(btBodys, 0, btBodys.Length);
43                HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
44                StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream());
45                string responseContent = streamReader.ReadToEnd();
46                Console.WriteLine(responseContent);
47                httpWebResponse.Close();
48                streamReader.Close();
49                httpWebRequest.Abort();
50                httpWebResponse.Close();
51            } catch (Exception e){
52                Console.Write(e.Message);
53            }    
54        }
55    }
56}

返回说明

返回参数

字段
是否必选
类型
说明
logid uint64 唯一的log id,用于问题定位
error_code int 0代表成功,如果有错误码返回可以参考下方错误码列表排查问题
error_msg string 如果error_code具体的失败信息,可以参考下方错误码列表排查问题
data jsonObject 识别返回的结果
+ ret jsonArray 识别出来的字段数组,每一个单元里包含以下几个元素
++ word_name string isStructured 为 true 时存在,表示字段的名字;如果 isStructured 为 false 时,不存在
++ word string 识别的字符串或单字
++ location jsonObject 字段在原图上对应的矩形框位置,通过上边距、左边距、宽度、高度表示
++ probability jsonObject 字段的置信度,包括平均、最小和方差
+ templateSign string 图片分类结果对应的模板id或指定使用的模版id。templateSign的对应关系为:
- mixed_receipt:混贴发票,可对粘贴单中的多张不同票据进行检测分类,返回每张发票的类别及识别结果;
- vat_invoice:增值税发票;
- taxi_receipt:出租车票;
- roll_ticket:卷票;
- train_ticket:火车票;
- quota_invoice:定额发票;
- air_ticket:行程单;
- car_invoice:汽车票;
- toll_invoice:通行费发票;
- printed_invoice:机打发票。
+ scores float 分类置信度,如果指定templateSign,则该值为1
+ isStructured string 表示是否结构化成功,true为成功,false为失败;成功时,返回结构化的识别结果;失败时,如果能识别,按行返回结果,如果不能识别,返回空

返回示例

  • 使用自定义模板及自定义分类器功能时,返回结果可参考 iOCR通用版-返回示例
  • templateSign = mixed_receipt 时,返回结果如下所示:
JSON
1{
2	"data": {
3		"ret": [
4			{
5				"ret": [
6					{
7						"rect": {
8							"top": 277,
9							"left": 237,
10							"width": 61,
11							"height": 10
12						},
13						"probability": {
14							"average": 0.98831981420517,
15							"min": 0.96548694372177
16						},
17						"word_name": "AmountInWords",
18						"word": "叁佰陆拾圆整"
19					},
20					{
21						"rect": {
22							"top": 29,
23							"left": 482,
24							"width": 85,
25							"height": 18
26						},
27						"probability": {
28							"average": 0.99745708703995,
29							"min": 0.99514311552048
30						},
31						"word_name": "InvoiceNumConfirm",
32						"word": "07286261"
33					},
34					{
35						"rect": {
36							"top": 352,
37							"left": 393,
38							"width": 32,
39							"height": 12
40						},
41						"probability": {
42							"average": 0.99022936820984,
43							"min": 0.98398983478546
44						},
45						"word_name": "NoteDrawer",
46						"word": "余佳燕"
47					},
48					{
49						"rect": {
50							"top": 326,
51							"left": 158,
52							"width": 214,
53							"height": 10
54						},
55						"probability": {
56							"average": 0.94039279222488,
57							"min": 0.39105615019798
58						},
59						"word_name": "SellerAddress",
60						"word": "杭州市转塘科技经济区块16号8幢0571-85022088"
61					},
62					{
63						"rect": {
64							"top": 311,
65							"left": 171,
66							"width": 146,
67							"height": 12
68						},
69						"probability": {
70							"average": 0.99681425094604,
71							"min": 0.98468536138535
72						},
73						"word_name": "SellerRegisterNum",
74						"word": "91330106673959654P"
75					},
76					{
77						"rect": {
78							"top": 0,
79							"left": 0,
80							"width": -1,
81							"height": -1
82						},
83						"probability": {
84							"average": 0,
85							"min": 0
86						},
87						"word_name": "MachineCode",
88						"word": ""
89					},
90					{
91						"rect": {
92							"top": 0,
93							"left": 0,
94							"width": -1,
95							"height": -1
96						},
97						"probability": {
98							"average": 0,
99							"min": 0
100						},
101						"word_name": "Remarks",
102						"word": ""
103					},
104					{
105						"rect": {
106							"top": 339,
107							"left": 158,
108							"width": 181,
109							"height": 11
110						},
111						"probability": {
112							"average": 0.99247741699219,
113							"min": 0.8911309838295
114						},
115						"word_name": "SellerBank",
116						"word": "招商银行杭州高新支行502905023610702"
117					},
118					{
119						"rect": {
120							"top": 259,
121							"left": 576,
122							"width": 43,
123							"height": 10
124						},
125						"probability": {
126							"average": 0.97683322429657,
127							"min": 0.89436012506485
128						},
129						"word_name": "TotalTax",
130						"word": "20.38"
131					},
132					{
133						"rect": {
134							"top": 32,
135							"left": 124,
136							"width": 101,
137							"height": 16
138						},
139						"probability": {
140							"average": 0.99661940336227,
141							"min": 0.99573355913162
142						},
143						"word_name": "InvoiceCodeConfirm",
144						"word": "3321192130"
145					},
146					{
147						"rect": {
148							"top": 0,
149							"left": 0,
150							"width": -1,
151							"height": -1
152						},
153						"probability": {
154							"average": 0,
155							"min": 0
156						},
157						"word_name": "CheckCode",
158						"word": ""
159					},
160					{
161						"rect": {
162							"top": 32,
163							"left": 124,
164							"width": 101,
165							"height": 16
166						},
167						"probability": {
168							"average": 0.99661940336227,
169							"min": 0.99573355913162
170						},
171						"word_name": "InvoiceCode",
172						"word": "3321192130"
173					},
174					{
175						"rect": {
176							"top": 65,
177							"left": 534,
178							"width": 73,
179							"height": 12
180						},
181						"probability": {
182							"average": 0.99508810043335,
183							"min": 0.97497177124023
184						},
185						"word_name": "InvoiceDate",
186						"word": "2019年08月28日"
187					},
188					{
189						"rect": {
190							"top": 104,
191							"left": 168,
192							"width": 147,
193							"height": 12
194						},
195						"probability": {
196							"average": 0.9933996796608,
197							"min": 0.96598559617996
198						},
199						"word_name": "PurchaserRegisterNum",
200						"word": "91110911717743469K"
201					},
202					{
203						"rect": {
204							"top": 18,
205							"left": 257,
206							"width": 164,
207							"height": 19
208						},
209						"probability": {
210							"average": 0.99611341953278,
211							"min": 0.98104286193848
212						},
213						"word_name": "InvoiceTypeOrg",
214						"word": "浙江增值税专用发票"
215					},
216					{
217						"rect": {
218							"top": 93,
219							"left": 405,
220							"width": 191,
221							"height": 45
222						},
223						"probability": {
224							"average": 0.97755342721939,
225							"min": 0.82740485668182
226						},
227						"word_name": "Password",
228						"word": "508>3909>1*>01/-46709-6/3+*7+8>/1*19+7-0**>+58290-6>647-+324865*9*1<*2191/7754/<0>2<838+//5-69--748*<251408<"
229					},
230					{
231						"rect": {
232							"top": 0,
233							"left": 0,
234							"width": -1,
235							"height": -1
236						},
237						"probability": {
238							"average": 0,
239							"min": 0
240						},
241						"word_name": "Agent",
242						"word": "否"
243					},
244					{
245						"rect": {
246							"top": 278,
247							"left": 511,
248							"width": 54,
249							"height": 10
250						},
251						"probability": {
252							"average": 0.95414996147156,
253							"min": 0.68566131591797
254						},
255						"word_name": "AmountInFiguers",
256						"word": "360.00"
257					},
258					{
259						"rect": {
260							"top": 134,
261							"left": 159,
262							"width": 204,
263							"height": 11
264						},
265						"probability": {
266							"average": 0.97773444652557,
267							"min": 0.61343103647232
268						},
269						"word_name": "PurchaserBank",
270						"word": "招商银行北京分行大电路支行866180100210002"
271					},
272					{
273						"rect": {
274							"top": 352,
275							"left": 259,
276							"width": 26,
277							"height": 12
278						},
279						"probability": {
280							"average": 0.98384791612625,
281							"min": 0.97088402509689
282						},
283						"word_name": "Checker",
284						"word": "柳余"
285					},
286					{
287						"rect": {
288							"top": 0,
289							"left": 0,
290							"width": -1,
291							"height": -1
292						},
293						"probability": {
294							"average": 0,
295							"min": 0
296						},
297						"word_name": "City",
298						"word": ""
299					},
300					{
301						"rect": {
302							"top": 258,
303							"left": 460,
304							"width": 49,
305							"height": 11
306						},
307						"probability": {
308							"average": 0.98758614063263,
309							"min": 0.9416212439537
310						},
311						"word_name": "TotalAmount",
312						"word": "339.62"
313					},
314					{
315						"rect": {
316							"top": 90,
317							"left": 159,
318							"width": 150,
319							"height": 12
320						},
321						"probability": {
322							"average": 0.96976244449615,
323							"min": 0.70321601629257
324						},
325						"word_name": "PurchaserName",
326						"word": "百度在线网络技术(北京)有限公司"
327					},
328					{
329						"rect": {
330							"top": 0,
331							"left": 0,
332							"width": -1,
333							"height": -1
334						},
335						"probability": {
336							"average": 0,
337							"min": 0
338						},
339						"word_name": "Province",
340						"word": "浙江"
341					},
342					{
343						"rect": {
344							"top": 18,
345							"left": 257,
346							"width": 164,
347							"height": 19
348						},
349						"probability": {
350							"average": 0.99611341953278,
351							"min": 0.98104286193848
352						},
353						"word_name": "InvoiceType",
354						"word": "专用发票"
355					},
356					{
357						"rect": {
358							"top": 145,
359							"left": 626,
360							"width": 9,
361							"height": 28
362						},
363						"probability": {
364							"average": 0.99723851680756,
365							"min": 0.99662339687347
366						},
367						"word_name": "SheetNum",
368						"word": "第二联"
369					},
370					{
371						"rect": {
372							"top": 119,
373							"left": 159,
374							"width": 158,
375							"height": 12
376						},
377						"probability": {
378							"average": 0.89263164997101,
379							"min": 0.21246993541718
380						},
381						"word_name": "PurchaserAddress",
382						"word": "北京市海淀区上地十侧10号百厘大厦三座"
383					},
384					{
385						"rect": {
386							"top": 353,
387							"left": 113,
388							"width": 22,
389							"height": 10
390						},
391						"probability": {
392							"average": 0.84802502393723,
393							"min": 0.560218334198
394						},
395						"word_name": "Payee",
396						"word": "佳机"
397					},
398					{
399						"rect": {
400							"top": 298,
401							"left": 158,
402							"width": 85,
403							"height": 11
404						},
405						"probability": {
406							"average": 0.96288979053497,
407							"min": 0.8344641327858
408						},
409						"word_name": "SellerName",
410						"word": "阿里云计算有限公司"
411					},
412					{
413						"rect": {
414							"top": 29,
415							"left": 482,
416							"width": 85,
417							"height": 18
418						},
419						"probability": {
420							"average": 0.99745708703995,
421							"min": 0.99514311552048
422						},
423						"word_name": "InvoiceNum",
424						"word": "07286261"
425					},
426					{
427						"rect": {
428							"top": 163,
429							"left": 71,
430							"width": 116,
431							"height": 11
432						},
433						"probability": {
434							"average": 0.9905007481575,
435							"min": 0.98428183794022
436						},
437						"word_name": "DetailsOfTax#1#CommodityName",
438						"word": "*信息技术服务*软件服务费"
439					},
440					{
441						"word_name": "DetailsOfTax#1#CommodityType",
442						"word": ""
443					},
444					{
445						"rect": {
446							"top": 164,
447							"left": 292,
448							"width": 10,
449							"height": 10
450						},
451						"probability": {
452							"average": 0.89159053564072,
453							"min": 0.80279469490051
454						},
455						"word_name": "DetailsOfTax#1#CommodityUnit",
456						"word": "套"
457					},
458					{
459						"rect": {
460							"top": 166,
461							"left": 360,
462							"width": 7,
463							"height": 8
464						},
465						"probability": {
466							"average": 0.95917397737503,
467							"min": 0.95113134384155
468						},
469						"word_name": "DetailsOfTax#1#CommodityNum",
470						"word": "1"
471					},
472					{
473						"rect": {
474							"top": 165,
475							"left": 397,
476							"width": 28,
477							"height": 9
478						},
479						"probability": {
480							"average": 0.97336208820343,
481							"min": 0.89550644159317
482						},
483						"word_name": "DetailsOfTax#1#CommodityPrice",
484						"word": "339.62"
485					},
486					{
487						"rect": {
488							"top": 165,
489							"left": 480,
490							"width": 28,
491							"height": 9
492						},
493						"probability": {
494							"average": 0.98559606075287,
495							"min": 0.96932607889175
496						},
497						"word_name": "DetailsOfTax#1#CommodityAmount",
498						"word": "339.62"
499					},
500					{
501						"rect": {
502							"top": 165,
503							"left": 522,
504							"width": 11,
505							"height": 9
506						},
507						"probability": {
508							"average": 0.92075562477112,
509							"min": 0.8382123708725
510						},
511						"word_name": "DetailsOfTax#1#CommodityTaxRate",
512						"word": "6%"
513					},
514					{
515						"rect": {
516							"top": 165,
517							"left": 595,
518							"width": 24,
519							"height": 9
520						},
521						"probability": {
522							"average": 0.97626549005508,
523							"min": 0.9149768948555
524						},
525						"word_name": "DetailsOfTax#1#CommodityTax",
526						"word": "20.38"
527					}
528				],
529				"receiptCoordinate": "{\"height\":642,\"left\":155,\"top\":178,\"width\":1106}",
530				"error_msg": "success",
531				"templateSign": "vat_invoice",
532				"scores": 1,
533				"templateName": "增值税发票",
534				"isStructured": true,
535				"error_code": 0
536			},
537			{
538				"ret": [
539					{
540						"probability": {
541							"average": 0,
542							"min": 0
543						},
544						"word_name": "PickupTime",
545						"word": "16:50"
546					},
547					{
548						"probability": {
549							"average": 0,
550							"min": 0
551						},
552						"word_name": "DropoffTime",
553						"word": "17:06"
554					},
555					{
556						"rect": {
557							"top": 212,
558							"left": 48,
559							"width": 66,
560							"height": 9
561						},
562						"probability": {
563							"average": 0.98931306600571,
564							"min": 0.92181307077408
565						},
566						"word_name": "Time",
567						"word": "16:50-17:06"
568					},
569					{
570						"probability": {
571							"average": 0,
572							"min": 0
573						},
574						"word_name": "City",
575						"word": ""
576					},
577					{
578						"rect": {
579							"top": 288,
580							"left": 84,
581							"width": 30,
582							"height": 9
583						},
584						"probability": {
585							"average": 0.99606895446777,
586							"min": 0.99255055189133
587						},
588						"word_name": "FuelOilSurcharge",
589						"word": "1.00"
590					},
591					{
592						"rect": {
593							"top": 198,
594							"left": 53,
595							"width": 61,
596							"height": 9
597						},
598						"probability": {
599							"average": 0.99483448266983,
600							"min": 0.98498445749283
601						},
602						"word_name": "Date",
603						"word": "2019-03-20"
604					},
605					{
606						"probability": {
607							"average": 0,
608							"min": 0
609						},
610						"word_name": "Province",
611						"word": "陕西省"
612					},
613					{
614						"probability": {
615							"average": 0,
616							"min": 0
617						},
618						"word_name": "CallServiceSurcharge",
619						"word": "0.00"
620					},
621					{
622						"rect": {
623							"top": 275,
624							"left": 76,
625							"width": 38,
626							"height": 9
627						},
628						"probability": {
629							"average": 0.98517167568207,
630							"min": 0.97685235738754
631						},
632						"word_name": "Fare",
633						"word": "21.10"
634					},
635					{
636						"rect": {
637							"top": 314,
638							"left": 76,
639							"width": 39,
640							"height": 9
641						},
642						"probability": {
643							"average": 0.97668653726578,
644							"min": 0.93554848432541
645						},
646						"word_name": "TotalFare",
647						"word": "2.00"
648					},
649					{
650						"rect": {
651							"top": 173,
652							"left": 72,
653							"width": 42,
654							"height": 8
655						},
656						"probability": {
657							"average": 0.98336416482925,
658							"min": 0.88234621286392
659						},
660						"word_name": "TaxiNum",
661						"word": "BQ6353"
662					},
663					{
664						"rect": {
665							"top": 225,
666							"left": 89,
667							"width": 25,
668							"height": 8
669						},
670						"probability": {
671							"average": 0.99482887983322,
672							"min": 0.99453765153885
673						},
674						"word_name": "PricePerkm",
675						"word": "2.30"
676					},
677					{
678						"rect": {
679							"top": 124,
680							"left": 14,
681							"width": 90,
682							"height": 11
683						},
684						"probability": {
685							"average": 0.99889290332794,
686							"min": 0.99876511096954
687						},
688						"word_name": "InvoiceCode",
689						"word": "161001881016"
690					},
691					{
692						"rect": {
693							"top": 238,
694							"left": 96,
695							"width": 18,
696							"height": 8
697						},
698						"probability": {
699							"average": 0.99126571416855,
700							"min": 0.98285579681396
701						},
702						"word_name": "Distance",
703						"word": "6.0"
704					},
705					{
706						"rect": {
707							"top": 137,
708							"left": 14,
709							"width": 60,
710							"height": 10
711						},
712						"probability": {
713							"average": 0.99211621284485,
714							"min": 0.94001615047455
715						},
716						"word_name": "InvoiceNum",
717						"word": "05070716"
718					},
719					{
720						"probability": {
721							"average": 0,
722							"min": 0
723						},
724						"word_name": "Location",
725						"word": "陕西省"
726					}
727				],
728				"receiptCoordinate": "{\"height\":618,\"left\":1325,\"top\":200,\"width\":215}",
729				"error_msg": "success",
730				"templateSign": "taxi",
731				"scores": 1,
732				"templateName": "出租车发票",
733				"isStructured": true,
734				"error_code": 0
735			}
736		],
737		"templateSign": "mixed_receipt",
738		"templateName": "混贴票据",
739		"scores": 1,
740		"isStructured": true,
741		"logId": "164196999300761",
742		"version": 1
743	},
744	"error_code": 0,
745	"error_msg": "",
746	"log_id": "164196999300761"
747}
上一篇
使用流程
下一篇
常见问题