Invoice identification method, system, electronic equipment and medium

文档序号:1738159 发布日期:2019-12-20 浏览:19次 中文

阅读说明:本技术 ***的识别方法、系统、电子设备和介质 (Invoice identification method, system, electronic equipment and medium ) 是由 周明康 罗超 胡泓 于 2019-09-17 设计创作,主要内容包括:本发明公开了一种发票的识别方法、系统、电子设备和介质,其中发票的识别方法包括以下步骤:获取发票图片;在发票图片的预选区域中获取目标区域的位置信息,目标区域包括待识别的目标文字;根据位置信息在目标区域中识别出目标文字。本发明提高了发票文字的识别效率,节省了人工成本。(The invention discloses an invoice identification method, an invoice identification system, electronic equipment and an invoice identification medium, wherein the invoice identification method comprises the following steps: acquiring an invoice picture; acquiring position information of a target area in a preselected area of an invoice picture, wherein the target area comprises target characters to be identified; and identifying the target characters in the target area according to the position information. The invention improves the identification efficiency of the invoice characters and saves the labor cost.)

1. An invoice identification method is characterized by comprising the following steps:

acquiring an invoice picture;

acquiring position information of a target area in a preselected area of the invoice picture, wherein the target area comprises target characters to be identified;

and identifying the target characters in the target area according to the position information.

2. The invoice identification method as claimed in claim 1, wherein after the step of obtaining an invoice picture, the invoice identification method further comprises the steps of:

adopting Gaussian filtering to perform noise reduction processing on the invoice picture to obtain a noise reduction picture;

the step of obtaining the location information of the target area in the preselected area of the invoice picture includes:

and acquiring the position information of the target area in the noise reduction picture.

3. The invoice identification method according to claim 1, wherein the invoice picture is a color picture, and the step of obtaining the position information of the target area in the preselected area of the invoice picture comprises the following steps:

s21, performing color channel separation on the preselected area to extract a target channel, setting the target channel as a first color, and setting the area except the target channel in the preselected area as a second color, wherein the target channel is a channel comprising a target color, and the target color is the color of the target characters;

and S22, carrying out corrosion and expansion operations on the preselected area, then carrying out horizontal projection and vertical projection operations, and acquiring the position coordinates of the target area in the invoice picture according to the position relation of the original information in the preselected area.

4. The invoice identification method according to claim 1, wherein the step of identifying the target text in the target area according to the position information comprises the following steps:

s31, generating a pre-training set, wherein the pre-training set comprises invoice pictures for training and identification results corresponding to the invoice pictures for training, the number of the invoice pictures for training is a first preset number, and the pre-training set is divided into a training set and a verification set;

s32, training an original character recognition model by adopting the training set to obtain a first character recognition model, wherein the original character recognition model is a character recognition model based on a convolutional neural network and a cyclic neural network;

s33, verifying the first character recognition model by adopting the verification set to obtain the accuracy of the first character recognition model, if the accuracy is smaller than a preset threshold, returning to the step S32, and if the accuracy is larger than or equal to the preset threshold, taking the first character recognition model as a target character recognition model;

and S34, recognizing the target characters in the target area according to the position information by adopting the target character recognition model.

5. The invoice recognition method according to claim 4, wherein the pre-training set further comprises position information of a target area corresponding to the training invoice picture.

6. The invoice identification method of claim 4, wherein the original text recognition model comprises a ResNet-50 classifier, a two-layer bi-directional LSTM and CTC decoder with a fully connected layer removed;

the ResNet-50 classifier removing the full connection layer is used for extracting the characteristic information of the invoice picture for training;

the two-layer bidirectional LSTM is used for receiving the characteristic information and performing text recognition to obtain a prediction result;

the CTC decoder is used for receiving the prediction result and performing CTC decoding to output the target characters.

7. The invoice identification method according to claim 4, wherein after generating the pre-training set, step S31 further comprises: and carrying out preprocessing operation on the invoice picture for training, wherein the preprocessing operation comprises at least one of noise addition, random rotation, affine change, horizontal turnover, vertical turnover, brightness adjustment and contrast adjustment.

8. The invoice identification system is characterized by comprising an image acquisition unit, a target area acquisition unit and a character identification unit;

the picture acquisition unit is used for acquiring an invoice picture;

the target area acquisition unit is used for acquiring position information of a target area in a preselected area of the invoice picture, wherein the target area comprises target characters to be identified;

the character recognition unit is used for recognizing the target characters in the target area according to the position information.

9. The invoice identification system of claim 8, further comprising a noise reduction unit;

the noise reduction unit is used for carrying out noise reduction processing on the invoice picture by adopting Gaussian filtering to obtain a noise reduction picture;

the target region acquiring unit is configured to acquire position information of the target region in the noise-reduced picture.

10. The invoice recognition system of claim 8, wherein the invoice picture is a color picture, and the target area acquisition unit is further configured to perform color channel separation on the preselected area to extract a target channel, and set the target channel as a first color, and set an area other than the target channel in the preselected area as a second color, wherein the target channel is a channel including a target color, and the target color is a color of the target text;

the target area acquisition unit is also used for carrying out corrosion and expansion operations on the preselected area, then carrying out horizontal projection and vertical projection operations, and acquiring the position coordinates of the target area in the invoice picture according to the position relation of the original information in the preselected area.

11. The invoice identification system of claim 8, wherein the text recognition unit is further configured to identify the target text by:

s31, generating a pre-training set, wherein the pre-training set comprises invoice pictures for training and identification results corresponding to the invoice pictures for training, the number of the invoice pictures for training is a first preset number, and the pre-training set is divided into a training set and a verification set;

s32, training an original character recognition model by adopting the training set to obtain a first character recognition model, wherein the original character recognition model is a character recognition model based on a convolutional neural network and a cyclic neural network;

s33, verifying the first character recognition model by adopting the verification set to obtain the accuracy of the first character recognition model, if the accuracy is smaller than a preset threshold, returning to the step S32, and if the accuracy is larger than or equal to the preset threshold, taking the first character recognition model as a target character recognition model;

and S34, recognizing the target characters in the target area according to the position information by adopting the target character recognition model.

12. The invoice identification system of claim 11, wherein the pre-training set further comprises location information for target areas corresponding to the training invoice images.

13. The invoice identification system of claim 11, wherein the original text recognition model comprises a ResNet-50 classifier, a two-layer bi-directional LSTM and CTC decoder with the full connectivity layer removed;

the ResNet-50 classifier removing the full connection layer is used for extracting the characteristic information of the invoice picture for training;

the two-layer bidirectional LSTM is used for receiving the characteristic information and performing text recognition to obtain a prediction result;

the CTC decoder is used for receiving the prediction result and performing CTC decoding to output the target characters.

14. The invoice recognition system of claim 11, wherein after generating a pre-training set, the text recognition unit is further configured to perform pre-processing operations on the training invoice picture, the pre-processing operations including at least one of adding noise, random rotation, affine change, horizontal flipping, vertical flipping, adjusting brightness, adjusting contrast.

15. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of identifying an invoice as claimed in any one of claims 1 to 7 when executing the computer program.

16. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of identification of an invoice as claimed in any one of claims 1 to 7.

Technical Field

The invention belongs to the technical field of invoice identification, and particularly relates to an invoice identification method, an invoice identification system, electronic equipment and an invoice identification medium.

Background

An invoice contains a large variety of text information, such as invoice number, amount, taxpayer identification number, and the like. In the prior art, each invoice is often checked manually, information in the invoice is input into a system, the efficiency is low, and the daily handling capacity of everyone is limited. And along with the increase of the fatigue degree of people, the accuracy of identifying the invoice information is reduced, and particularly errors are easy to occur on the complicated text contents with more numbers such as tax payer identification numbers, invoice numbers and the like.

Disclosure of Invention

The invention aims to overcome the defects of low invoice information identification efficiency and low invoice information identification accuracy in the prior art, and provides an invoice identification method, an invoice identification system, electronic equipment and an invoice identification medium.

The invention solves the technical problems through the following technical scheme:

the invention provides an invoice identification method, which comprises the following steps:

acquiring an invoice picture;

acquiring position information of a target area in a preselected area of an invoice picture, wherein the target area comprises target characters to be identified;

and identifying the target characters in the target area according to the position information.

Preferably, after the step of obtaining the invoice picture, the invoice identification method further includes the following steps:

adopting Gaussian filtering to perform noise reduction processing on the invoice picture to obtain a noise reduction picture;

the step of acquiring the position information of the target area in the preselected area of the invoice picture comprises the following steps:

and acquiring the position information of the target area in the noise reduction picture.

Preferably, the invoice picture is a color picture, and the step of obtaining the position information of the target area in the preselected area of the invoice picture comprises the following steps:

s21, performing color channel separation on the preselected area to extract a target channel, setting the target channel as a first color, and setting the area except the target channel in the preselected area as a second color, wherein the target channel is a channel comprising a target color, and the target color is the color of the target characters;

and S22, carrying out corrosion and expansion operations on the preselected area, then carrying out horizontal projection and vertical projection operations, and acquiring the position coordinates of the target area in the invoice picture according to the position relation of the original information in the preselected area.

Preferably, the step of identifying the target text in the target area according to the position information includes the steps of:

s31, generating a pre-training set, wherein the pre-training set comprises training invoice pictures and identification results corresponding to the training invoice pictures, the number of the training invoice pictures is a first preset number, and the pre-training set is divided into a training set and a verification set;

s32, training the original character recognition model by adopting a training set to obtain a first character recognition model, wherein the original character recognition model is a character recognition model based on a convolutional neural network and a cyclic neural network;

s33, verifying the first character recognition model by adopting a verification set to obtain the accuracy of the first character recognition model, if the accuracy is smaller than a preset threshold, returning to the step S32, and if the accuracy is larger than or equal to the preset threshold, taking the first character recognition model as a target character recognition model;

and S34, recognizing the target characters in the target area according to the position information by adopting the target character recognition model.

Preferably, the pre-training set further includes location information of the target area corresponding to the invoice picture for training.

Preferably, the original text recognition model includes a ResNet-50 (a classifier) classifier with a fully connected layer removed, two-layer two-way LSTM (Long Short-Term Memory) and CTC (ConnectionTestumClassification), decoders;

the ResNet-50 classifier without the full connection layer is used for extracting the characteristic information of the invoice picture for training;

the two-layer bidirectional LSTM is used for receiving the characteristic information and performing text recognition to obtain a prediction result;

and the CTC decoder is used for receiving the prediction result and performing CTC decoding to output the target characters.

Preferably, after generating the pre-training set, step S31 further includes: and carrying out preprocessing operation on the invoice picture for training, wherein the preprocessing operation comprises at least one of noise addition, random rotation, affine change, horizontal turnover, vertical turnover, brightness adjustment and contrast adjustment.

The invention also provides an invoice identification system, which comprises an image acquisition unit, a target area acquisition unit and a character identification unit;

the picture acquisition unit is used for acquiring invoice pictures;

the target area acquisition unit is used for acquiring position information of a target area in a preselected area of the invoice picture, and the target area comprises target characters to be identified;

the character recognition unit is used for recognizing the target characters in the target area according to the position information.

Preferably, the invoice identification system further comprises a noise reduction unit;

the noise reduction unit is used for performing noise reduction processing on the invoice picture by adopting Gaussian filtering to obtain a noise reduction picture;

the target region acquiring unit is configured to acquire position information of the target region in the noise-reduced picture.

Preferably, the invoice picture is a color picture, and the target area obtaining unit is further used for

Performing color channel separation on the preselected area to extract a target channel, setting the target channel as a first color, and setting the area except the target channel in the preselected area as a second color, wherein the target channel is a channel comprising a target color, and the target color is the color of the target character;

the target area acquisition unit is also used for carrying out corrosion and expansion operations on the preselected area, then carrying out horizontal projection and vertical projection operations, and acquiring the position coordinates of the target area in the invoice picture according to the position relation of the original information in the preselected area.

Preferably, the character recognition unit is further configured to recognize the target character by:

s31, generating a pre-training set, wherein the pre-training set comprises training invoice pictures and identification results corresponding to the training invoice pictures, the number of the training invoice pictures is a first preset number, and the pre-training set is divided into a training set and a verification set;

s32, training the original character recognition model by adopting a training set to obtain a first character recognition model, wherein the original character recognition model is a character recognition model based on a convolutional neural network and a cyclic neural network;

s33, verifying the first character recognition model by adopting a verification set to obtain the accuracy of the first character recognition model, if the accuracy is smaller than a preset threshold, returning to the step S32, and if the accuracy is larger than or equal to the preset threshold, taking the first character recognition model as a target character recognition model;

and S34, recognizing the target characters in the target area according to the position information by adopting the target character recognition model.

Preferably, the pre-training set further includes location information of the target area corresponding to the invoice picture for training.

Preferably, the original text recognition model includes a ResNet-50 classifier with a fully connected layer removed, a two-layer bi-directional LSTM and CTC decoder;

the ResNet-50 classifier without the full connection layer is used for extracting the characteristic information of the invoice picture for training;

the two-layer bidirectional LSTM is used for receiving the characteristic information and performing text recognition to obtain a prediction result;

and the CTC decoder is used for receiving the prediction result and performing CTC decoding to output the target characters.

Preferably, after generating the pre-training set, the character recognition unit is further configured to perform a pre-processing operation on the training invoice picture, where the pre-processing operation includes at least one of adding noise, randomly rotating, affine variation, horizontal flipping, vertical flipping, adjusting brightness, and adjusting contrast.

The invention also provides electronic equipment which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the computer program to realize the invoice identification method.

The invention also provides a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of identification of invoices of the invention.

The positive progress effects of the invention are as follows: the invention improves the identification efficiency of the invoice characters and saves the labor cost.

Drawings

Fig. 1 is a flowchart of an invoice identification method according to embodiment 1 of the present invention.

Fig. 2 is a schematic diagram of an invoice picture of the identification method of an invoice according to embodiment 1 of the present invention.

Fig. 3 is a schematic diagram of a preselected region of an invoice picture of the identification method of an invoice according to embodiment 1 of the present invention.

Fig. 4 is a flowchart of step S12 of the invoice identification method according to embodiment 1 of the present invention.

Fig. 5 is a schematic diagram illustrating the effect of the method for identifying an invoice according to embodiment 1 of the present invention after target channels are extracted from the preselected area.

Fig. 6 is a schematic diagram showing the effect of gaussian filtering on a preselected region of the invoice identification method according to embodiment 1 of the present invention.

Fig. 7 is a schematic diagram showing the effect of corrosion on a preselected region of the identification method of an invoice according to embodiment 1 of the present invention.

Fig. 8 is a schematic diagram showing the effect of the expansion of the preselected area of the identification method of the invoice according to embodiment 1 of the present invention.

Fig. 9 is a flowchart of step S13 of the invoice identification method according to embodiment 1 of the present invention.

Fig. 10 is a schematic structural diagram of an invoice identification system according to embodiment 1 of the present invention.

Fig. 11 is a schematic structural diagram of an electronic device according to embodiment 2 of the present invention.

Detailed Description

The invention is further illustrated by the following examples, which are not intended to limit the scope of the invention.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:车辆识别码的检测方法、装置及计算机设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!