请求财会票据识别接口 https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance
按文档说明,其中有三个非必填参数:
templateSign 模板id
detectorId 检测器id ,可选值仅有0。detectorId = 0时,启用票据分类检测功能,可对发票粘贴单上的多张不同种类票据进行分类检测和识别
classifierId 分类器Id 分类器Id,用于指定使用哪个分类器。templateSign、classifierId与detectorId需保证至少存在一个,优先使用templateSign:存在templateSign时,表示使用指定模板;如果没有 templateSign而detectorId = 0,则使用票据检测分类功能;仅有classifierId,则使用指定分类器去判断使用哪个模板
如果给定 templateSign 属性,则返回正常
如果只传:detectorId 属性(值为0),就报错,报错内容:{"error_msg":"invalid param, modelId is not number,please check your param","data":{"isStructured":false,"logId":"156146146659325"},"error_code":282004}。
但想要 启用票据分类检测功能,对发票粘贴单上的多张不同种类票据进行分类检测和识别。不知如何实现
请教如何实现
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
通过HttpResponseMessage reponse = client.PostAsync(authHost, new FormUrlEncodedContent(paraList)).Result没有正确获取的access_token,报错信息如下:{StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent。
这个应该怎么解决呢?
实现了吗?
参考一下python的demo哈
# encoding=utf-8
import requests,json,base64
from urllib import quote
import os
headers = {
'Content-Type': "application/x-www-form-urlencoded",
'cache-control': "no-cache"
};
def test_detect_image_vaild(image_path, url):
image = open(save_image_path, 'rb');
imageBase64str = base64.b64encode(image.read()).replace("\r", "");
payload = {"detectorId":"0", "image":imageBase64str}
response = requests.post(url, data=payload, headers=headers);
print(response.text);
if __name__ == '__main__':
save_image_path = ${image_path};
url = "https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise/finance"
token = ${access_token}
test_detect_image_vaild(save_image_path, url + "?access_token=" + token)
是否只传了detectorId这个参数,
你的detectorId这个参数名 传对了嘛?
access_token 正确嘛