Best Practice | Using Tencent Cloud AI Text Recognition to Realize Communication Travel Card Recognition from 0 to 1

Under the normalization of epidemic prevention and control, in order to ensure the health and safety of children, the school requires all personnel entering the school to provide and review the communication itinerary code. However, through manual review, it is not only a lot of work but also prone to errors. As a software development engineer, I started to think and investigate, hoping to solve it in a smarter way.

During the research process, it was found that Tencent Cloud AI text recognition products have launched a variety of automatic recognition capabilities such as health code OCR and travel card OCR , which just fits the real problem of intelligent recognition. But are the identified results accurate?

I checked the official introduction materials and found that Tencent Cloud AI and Tencent Youtu Lab have optimized and innovated key technologies for text detection and text recognition. In-depth optimization of text detection technology is carried out, and Compact Inception is proposed to improve the text detection/extraction ability of various scales by designing a reasonable network structure. At the same time, the RNN multi-layer adaptive network and the Refinement structure are introduced to improve the detection integrity and accuracy.

In terms of text recognition, after a lot of experiments and practice, the mainstream CNN+RNN+CTC method has been improved and innovated: the horizontal asymmetric convolution and the characteristics of the receptive field of multiple scales are added to the CNN, which enhances the network's ability to respond to multiple scales. Font support. The Attention mechanism is added to the RNN. The addition of the Attention mechanism can obtain the global weight information of each feature block on the basis of all feature blocks, effectively improving the accuracy of the entire line recognition. This undoubtedly gave us reassurance, and we can safely use the automatic recognition capabilities of Tencent Cloud AI text recognition.

According to the product capability introduction, the communication itinerary card recognition capability can automatically identify the color of the itinerary, the place of travel, the city in the medium and high risk areas, the phone number and other information, which realizes a fully automatic mode and greatly reduces the work of manual review. quantity.

Next, I'll go into detail about how I used the communication trip card recognition capability.

01. Preparations

In order to use the communication itinerary card recognition capability, we need to make some preparations.

1. Tencent Cloud AI text recognition provides an experience service (function demo page). We first experienced the ability of the communication itinerary card, and the Demo recognition effect is very good.

图片

2. 在使用腾讯云AI文字识别之前需要开通文字识别服务。在腾讯云OCR控制台页面,我们成功开通了文字识别服务。

图片

3.服务开通成功后,腾讯云AI文字识别赠送了免费的资源包,50~1000次的免费额度。当免费资源包用尽后,我们先是购买了预付费资源包,后来又开通了后付费。

在购买页购买了通信行程卡识别1千次的资源包。在资源包管理页面中看到了资源包的具体使用情况。

图片

在设置页面开通了后付费服务,每个月来结算。后付费设置每月只能变更一次,而且变更后次日0点生效。

图片

02.操作流程

通过下面几个步骤我们正式开始使用通信行程卡能力。

  • 获取个人密钥

  • 通信行程卡API文档

  • 体验在线调用

  • 使用集成腾讯云OCR的SDK

  • 查询调用量

2.1获取个人密钥

第一步,我们需要个人密钥。在腾讯云访问管理的API密钥管理页面,我们新建了个人密钥。

图片

2.2通信行程卡识别API文档

第二步,就是查看具体的使用说明了,在文字识别的API文档中查看了通信行程卡识别的输入入参、输出出参、错误码等信息。

图片

2.3体验在线调试

第三步,腾讯云AI文字识别还提供了在线调用API Explorer工具,我们通过这个工具体验了下在线调用,更加直观的看到了请求参数和返回值。

图片

2.4使用集成腾讯云OCR的SDK

第四步,就是真正的使用。

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言。在API文档文档的最下方,我们查看了SDK具体使用方法,十分简单方便。

我们使用的开发语言是 Node.js 。

  • 通过 npm 安装

    npm install tencentcloud-sdk-nodejs --save

  • 使用SDK调用通信行程卡识别接口

    const tencentcloud = require("../tencentcloud-sdk-nodejs");

    const OcrClient = tencentcloud.ocr.v20181119.Client; const models = tencentcloud.ocr.v20181119.Models;

    const Credential = tencentcloud.common.Credential; const ClientProfile = tencentcloud.common.ClientProfile; const HttpProfile = tencentcloud.common.HttpProfile;

    let cred = new Credential(" SecretId ", " SecretKey "); let httpProfile = new HttpProfile(); let clientProfile = new ClientProfile(); /* 推荐使用 V3 鉴权。当内容超过 1M 时,必须使用 V3 签名鉴权。除 Node SDK 外,其他语言 SDK 都支持 V3。 clientProfile.signMethod = "TC3-HMAC-SHA256"; */ clientProfile.httpProfile = httpProfile; let client = new OcrClient(cred, "ap-guangzhou", clientProfile);

    let req = new models.RecognizeTravelCardOCRRequest();

    req.ImageUrl = "test.jpg";

    client.RecognizeTravelCardOCR(req, function(errMsg, response) {

    if (errMsg) { console.log(errMsg); return; }

    console.log(response.to_json_string());

    });

2.5查询调用量

第五步,调用成功后,我们在腾讯云OCR控制台查看了接口的调用明细,包括了调用量、成功量、失败量等信息。

图片

主账号登录后查看了所有账号的调用量明细,子账号只能查询自己的调用量明细。在用量查询权限管理页面给子账号赋权后,子账号也查询到了所有子账号的调用量明细权限了。

图片

Guess you like

Origin juejin.im/post/7096766841745309732