CN117351492A - Value-added tax invoice information identification method - Google Patents

Value-added tax invoice information identification method Download PDF

Info

Publication number
CN117351492A
CN117351492A CN202311257686.8A CN202311257686A CN117351492A CN 117351492 A CN117351492 A CN 117351492A CN 202311257686 A CN202311257686 A CN 202311257686A CN 117351492 A CN117351492 A CN 117351492A
Authority
CN
China
Prior art keywords
image
target
added tax
tax invoice
character
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311257686.8A
Other languages
Chinese (zh)
Inventor
王彦瑞
杜旭江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Langsi Intelligent Technology Co ltd
Original Assignee
Beijing Langsi Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Langsi Intelligent Technology Co ltd filed Critical Beijing Langsi Intelligent Technology Co ltd
Priority to CN202311257686.8A priority Critical patent/CN117351492A/en
Publication of CN117351492A publication Critical patent/CN117351492A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/1444Selective acquisition, locating or processing of specific regions, e.g. highlighted text, fiducial marks or predetermined fields
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/146Aligning or centring of the image pick-up or image-field
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/16Image preprocessing
    • G06V30/164Noise filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/18Extraction of features or characteristics of the image
    • G06V30/18105Extraction of features or characteristics of the image related to colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/412Layout analysis of documents structured with printed lines or input boxes, e.g. business forms or tables

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Character Input (AREA)

Abstract

The invention discloses a value-added tax invoice information identification method, which relates to the technical field of image processing and comprises the following steps: acquiring an image of a value added tax invoice, and preprocessing the image of the value added tax invoice to obtain a target image; dividing the target image into areas to form a plurality of target areas containing target information; identifying the characters in the target area and extracting the target information; and storing and outputting the extracted target information. The invention realizes the rapid and accurate identification and information extraction of the value-added tax invoice by using the computer vision and machine learning technology, reduces the workload and the error rate of manually processing the value-added tax invoice, and improves the processing efficiency and the accuracy.

Description

Value-added tax invoice information identification method
Technical Field
The invention relates to the technical field of image processing, in particular to a value-added tax invoice information identification method.
Background
Processing a large number of value-added tax invoices is a tedious and time-consuming task, and is currently generally performed manually. The data is manually entered and processed at the time of processing. Not only is the efficiency low, but also mistakes are easy to occur, and the accuracy of data is affected.
Disclosure of Invention
The invention aims to solve the technical problem of overcoming the defects of the prior art and providing a value-added tax invoice information identification method.
In order to solve the technical problems, the technical scheme of the invention is as follows:
a value-added tax invoice information identification method is characterized in that: comprising the following steps:
acquiring an image of a value added tax invoice, and preprocessing the image of the value added tax invoice to obtain a target image;
dividing the target image into areas to form a plurality of target areas containing target information;
identifying the characters in the target area and extracting the target information;
and storing and outputting the extracted target information.
As a preferable scheme of the value-added tax invoice information identification method, the invention comprises the following steps: the acquiring the image of the value added tax invoice comprises the following steps:
and obtaining the image of the value added tax invoice by scanning and shooting the value added tax invoice or converting the value added tax invoice file in other formats into an image.
As a preferable scheme of the value-added tax invoice information identification method, the invention comprises the following steps: the preprocessing of the image of the value added tax invoice to obtain a target image comprises the following steps:
denoising, improving brightness, improving contrast and improving saturation of the image of the increment tax invoice, so that the image is enhanced;
judging whether the image of the value added tax invoice is skewed, converting the image into a single-channel gray level image when the image exists, detecting all contours in the image, calculating the area of each contour, determining the contour with the largest area as the position of the form of the value added tax invoice, calculating the perimeter of the contour, and determining the corresponding parameter coefficient to enable the contour to be infinitely close to the form grid line of the value added tax invoice.
As a preferable scheme of the value-added tax invoice information identification method, the invention comprises the following steps: the dividing the target image into regions to form a plurality of target regions containing target information comprises:
identifying a value-added tax invoice image in a standard format, determining the distance between the unit cells containing target information in the form of the value-added tax invoice and the ratio between the total length and the total width of the form, and forming a form rule;
identifying the target image and determining the outline position of a table in the target image;
and carrying out proportional mapping on the table outline in the target image through the table rule, and calculating the coordinate positions of each cell containing target information in the table outline in the target image to form a plurality of target areas containing the target information.
As a preferable scheme of the value-added tax invoice information identification method, the invention comprises the following steps: the identifying of the character in the target area includes:
performing open source character recognition on the target area, performing text detection on the target area through a text detection model, and determining a character area in the target area;
and carrying out character recognition on the character area through a text character recognition model to obtain character information in the target area.
As a preferable scheme of the value-added tax invoice information identification method, the invention comprises the following steps: the character recognition of the character area through the text character recognition model comprises the following steps:
judging whether a red seal shields characters in the character area, if so, performing the next step, and if not, performing character recognition on the character area through a text character recognition model;
performing color channel separation on the target image, separating the three-channel target image into a blue channel, a green channel and a red channel, removing gray elements in the separated red channel, desalting to obtain a single-channel target image, and converting the single-channel target image into a three-channel gray image;
and carrying out character recognition on the character area through a text character recognition model.
As a preferable scheme of the value-added tax invoice information identification method, the invention comprises the following steps: the character recognition of the character area through the text character recognition model comprises the following steps:
judging whether a red seal shields characters in the character area, if so, performing the next step, and if not, performing character recognition on the character area through a text character recognition model;
converting the pre-read RGB color space of the target image into an HSV color space, determining and selecting a red HSV color space color gamut in the target image as a red threshold value in threshold value screening, and setting a pixel value in the red threshold value range in the target image to 255;
and carrying out character recognition on the character area through a text character recognition model.
As a preferable scheme of the value-added tax invoice information identification method, the invention comprises the following steps: the extracting the target information comprises the following steps:
performing polygon character frame coordinate ordering processing on the characters identified in each character area, and determining character frame sets in the same row;
ordering all character frames positioned in the same row according to the abscissa, and merging the character frames positioned in the same row to obtain target information in each character area;
and extracting the target information through the regular expression.
As a preferable scheme of the value-added tax invoice information identification method, the invention comprises the following steps: the storing and outputting the extracted target information comprises the following steps:
storing the extracted target information in a mode of key value pairs according to character strings, lists and JSON formats, and storing the extracted target information in a database or other storage media;
and outputting the target information to a user interface for display or further processing.
As a preferable scheme of the value-added tax invoice information identification method, the invention comprises the following steps: the outputting the target information to the user interface for display or further processing comprises the following steps:
and outputting the target information to a user interface for display or further processing according to a table form.
The beneficial effects of the invention are as follows:
(1) The invention realizes the rapid and accurate identification and information extraction of the value-added tax invoice by using the computer vision and machine learning technology, reduces the workload and the error rate of manually processing the value-added tax invoice, and improves the processing efficiency and the accuracy.
(2) Aiming at value-added tax invoices with different formats and styles, the invention has certain adaptability and flexibility, can adapt to various invoice layouts and languages, and simultaneously provides an extensible and customizable architecture, so that the system can adapt to application scenes with different scales and demands.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for identifying value added tax invoice information provided by the invention;
FIG. 2 is a schematic flow chart of step S102 in the method for identifying value-added tax invoice information provided by the invention;
fig. 3 is a schematic flow chart of extracting target information in the value-added tax invoice information identification method provided by the invention.
Detailed Description
In order that the invention may be more readily understood, a more particular description thereof will be rendered by reference to specific embodiments that are illustrated in the appended drawings.
Fig. 1 is a flow chart of a method for identifying value-added tax invoice information according to an embodiment of the present application. The method comprises the following steps of S101-S104, wherein the specific steps are as follows:
step S101: and acquiring an image of the value added tax invoice, and preprocessing the image of the value added tax invoice to obtain a target image.
Specifically, the image of the value-added tax invoice can be obtained by scanning or shooting the value-added tax invoice. Meanwhile, the image of the value added tax invoice can be obtained by converting the value added tax invoice file with other formats, such as a PDF format file, into a picture file.
And taking the obtained value-added tax invoice image as an image to be processed, and preprocessing the value-added tax invoice image to obtain a target image.
The preprocessing operation includes removing noise from the image to be processed to increase smoothness of the image, and then performing brightness enhancement, contrast enhancement and saturation enhancement on the image to be processed, so as to achieve the purpose of image enhancement.
In addition, the preprocessing operation also comprises judging whether the image of the value added tax invoice is skewed. For a value added tax invoice image with skew, converting the value added tax invoice image into a single-channel gray level image, detecting all contours in the value added tax invoice image on the basis of the gray level image, calculating the contour area of each contour, judging that the contour with the largest area is the position of a table in the value added tax invoice image, calculating the perimeter of the contour, determining corresponding parameter coefficients, enabling the contour to be in wireless proximity to the table line of the value added tax invoice, determining the specific coordinate standard of the table position in the value added tax invoice, improving the basic standard of the position of each specific unit in the follow-up segmentation value added tax invoice, and ensuring the accuracy of follow-up identification.
It is understood that the above operation mode is an operation mode in OpenCV.
Step S102: and dividing the target image into areas to form a plurality of target areas containing target information.
Specifically, because the electronic invoice of the value-added tax and the paper invoice of the value-added tax are in the national accurate standard format, namely, the electronic invoice of the value-added tax has the characteristics of specific form interval and fixed information printing position, the positions of a plurality of target areas containing target information in the image of the value-added tax can be determined by identifying the value-added tax invoice in the national standard format in advance. Referring to fig. 2, the specific steps are as follows:
step S102a: and identifying the value-added tax invoice image in the standard format, determining the spacing between the cells containing the target information in the form of the value-added tax invoice and the ratio between the total length and the total width of the form, and forming a form rule.
Step S102b: and identifying the target image and determining the outline position of the table in the target image.
Step S102c: and carrying out proportional mapping on the table outline in the target image through the table rule, calculating the coordinate positions of each cell containing target information in the table outline in the target image, and forming a plurality of target areas containing the target information.
Specifically, relevant information such as invoice head-up, billing date, purchaser name, purchaser address, password area, goods detail amount and the like is target information. If the form is the full-electric invoice form, the space ratio among the rows is not necessarily the same because of the characteristic of the fixed width and the variable length of the form of the full-electric invoice, so after the width of the full-electric invoice form is identified and mapped, the detail and the segmentation of the specific row and column project of the full-electric invoice are calculated by identifying all transverse lines in the width range, thereby being convenient for the next character identification and acquisition.
Step S103: and identifying the characters in the target area and extracting the target information.
Specifically, firstly, performing open source character recognition on a target area, performing text detection on the target area through a text detection model, and determining a character area in the target area. And then, character recognition is carried out on the character area through a text character recognition model, so that character information in the target area is obtained.
In this embodiment, an open source Optical Character Recognition (OCR) technique is used to select a text character detection model and a text character recognition model with recognition accuracy of 83.5%, perform character detection on an image, determine positions of possible chinese characters in all the image, and perform specific chinese character recognition on the recognized text region, thereby achieving the purpose of recognizing specific chinese characters in the image.
When character recognition is carried out on the character area through the text character recognition model, judging whether a red seal shielding character exists in the character area or not for a value-added tax invoice sample with poor character recognition effect, and if the character recognition effect is poor due to the red seal shielding, carrying out red seal removal on the value-added tax invoice by using a technology for removing the red seal. The method comprises the following steps:
and (3) carrying out color channel separation on the target image, separating the three-channel target image into a blue channel, a green channel and a red channel, removing gray elements in the separated red channel, desalting to obtain a single-channel target image, and converting the single-channel target image into a three-channel gray image. And then character recognition is carried out on the character area through a text character recognition model.
In addition, the removal of the red stamp may also be performed by threshold screening techniques. The RGB color space of the original pre-reading of the value added tax invoice is converted into an HSV color space, a plurality of sections of red HSV color space color gamut which occurs most frequently in the value added tax invoice are determined and selected as red threshold values in threshold value screening through specific color gamut judgment of red, and if the pixel value of the value added tax invoice is in the range of the color threshold values, the pixel of the value added tax invoice is set to 255 (namely white), so that the purpose of removing the red seal is achieved.
For the identified text field after the segmentation of the value added tax information area, information extraction needs to be performed on the text field, see fig. 3, and the specific steps are as follows:
step S201: and carrying out polygon character frame coordinate sorting processing on the characters identified in each character area, and determining character frame sets in the same row.
Step S202: and sequencing all character frames positioned in the same row according to the abscissa, and merging the character frames positioned in the same row to obtain invoice information in each character area.
Specifically, in the character frame set of the same row, the text sequence of the horizontal axis is consistent with the text sequence in the value-added tax invoice picture, and the accuracy of the text information is ensured. And combining the characters belonging to the same row in the cell, and performing character matching extraction processing.
Step S203: and extracting the target information through the regular expression.
Specifically, the key information of the required value-added tax invoice is extracted through specific rule information such as regular expressions and the like, and the key information of the value-added tax invoice is extracted and analyzed from the identified characters, such as invoice number, invoice date, seller name, account, address, bank information, purchaser name, account, address, bank information, commodity detail and amount, tax rate and the like.
Step S104: and storing and outputting the extracted target information.
Specifically, the extracted value added tax invoice information is stored in a key value pair mode (such as a buyer name: XX company) according to a character string, a list and a JSON format, and is stored in a database or other storage media.
For the target information such as detailed goods detail in the value-added tax invoice, the target information is displayed in a form special for use and can be exported in an Excel format, and can be output to a user interface or other systems for further processing or display.
Therefore, the technical scheme of the method and the device realize quick and accurate identification and information extraction of the value-added tax invoice by using computer vision and machine learning technology, reduce the cost of processing the value-added tax invoice by enterprises and individuals, reduce the workload and error rate of manually processing the value-added tax invoice, and improve the processing efficiency and accuracy.
In addition to the above embodiments, the present invention may have other embodiments; all technical schemes formed by equivalent substitution or equivalent transformation fall within the protection scope of the invention.

Claims (10)

1. A value-added tax invoice information identification method is characterized in that: comprising the following steps:
acquiring an image of a value added tax invoice, and preprocessing the image of the value added tax invoice to obtain a target image;
dividing the target image into areas to form a plurality of target areas containing target information;
identifying the characters in the target area and extracting the target information;
and storing and outputting the extracted target information.
2. The value added tax invoice information recognition method as claimed in claim 1, wherein: the acquiring the image of the value added tax invoice comprises the following steps:
and obtaining the image of the value added tax invoice by scanning and shooting the value added tax invoice or converting the value added tax invoice file in other formats into an image.
3. The value added tax invoice information recognition method as claimed in claim 1, wherein: the preprocessing of the image of the value added tax invoice to obtain a target image comprises the following steps:
denoising, improving brightness, improving contrast and improving saturation of the image of the increment tax invoice, so that the image is enhanced;
judging whether the image of the value added tax invoice is skewed, converting the image into a single-channel gray level image when the image exists, detecting all contours in the image, calculating the area of each contour, determining the contour with the largest area as the position of the form of the value added tax invoice, calculating the perimeter of the contour, and determining the corresponding parameter coefficient to enable the contour to be infinitely close to the form grid line of the value added tax invoice.
4. The value added tax invoice information recognition method as claimed in claim 1, wherein: the dividing the target image into regions to form a plurality of target regions containing target information comprises:
identifying a value-added tax invoice image in a standard format, determining the distance between the unit cells containing target information in the form of the value-added tax invoice and the ratio between the total length and the total width of the form, and forming a form rule;
identifying the target image and determining the outline position of a table in the target image;
and carrying out proportional mapping on the table outline in the target image through the table rule, and calculating the coordinate positions of each cell containing target information in the table outline in the target image to form a plurality of target areas containing the target information.
5. The value added tax invoice information recognition method as claimed in claim 1, wherein: the identifying of the character in the target area includes:
performing open source character recognition on the target area, performing text detection on the target area through a text detection model, and determining a character area in the target area;
and carrying out character recognition on the character area through a text character recognition model to obtain character information in the target area.
6. The value added tax invoice information recognition method as claimed in claim 5, wherein: the character recognition of the character area through the text character recognition model comprises the following steps:
judging whether a red seal shields characters in the character area, if so, performing the next step, and if not, performing character recognition on the character area through a text character recognition model;
performing color channel separation on the target image, separating the three-channel target image into a blue channel, a green channel and a red channel, removing gray elements in the separated red channel, desalting to obtain a single-channel target image, and converting the single-channel target image into a three-channel gray image;
and carrying out character recognition on the character area through a text character recognition model.
7. The value added tax invoice information recognition method as claimed in claim 5, wherein: the character recognition of the character area through the text character recognition model comprises the following steps:
judging whether a red seal shields characters in the character area, if so, performing the next step, and if not, performing character recognition on the character area through a text character recognition model;
converting the pre-read RGB color space of the target image into an HSV color space, determining and selecting a red HSV color space color gamut in the target image as a red threshold value in threshold value screening, and setting a pixel value in the red threshold value range in the target image to 255;
and carrying out character recognition on the character area through a text character recognition model.
8. The value added tax invoice information recognition method of claim 6 or 7, wherein: the extracting the target information comprises the following steps:
performing polygon character frame coordinate ordering processing on the characters identified in each character area, and determining character frame sets in the same row;
ordering all character frames positioned in the same row according to the abscissa, and merging the character frames positioned in the same row to obtain target information in each character area;
and extracting the target information through the regular expression.
9. The value added tax invoice information recognition method as claimed in claim 1, wherein: the storing and outputting the extracted target information comprises the following steps:
storing the extracted target information in a mode of key value pairs according to character strings, lists and JSON formats, and storing the extracted target information in a database or other storage media;
and outputting the target information to a user interface for display or further processing.
10. The value added tax invoice information recognition method of claim 9, wherein: the outputting the target information to the user interface for display or further processing comprises the following steps:
and outputting the target information to a user interface for display or further processing according to a table form.
CN202311257686.8A 2023-09-27 2023-09-27 Value-added tax invoice information identification method Pending CN117351492A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311257686.8A CN117351492A (en) 2023-09-27 2023-09-27 Value-added tax invoice information identification method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311257686.8A CN117351492A (en) 2023-09-27 2023-09-27 Value-added tax invoice information identification method

Publications (1)

Publication Number Publication Date
CN117351492A true CN117351492A (en) 2024-01-05

Family

ID=89368278

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311257686.8A Pending CN117351492A (en) 2023-09-27 2023-09-27 Value-added tax invoice information identification method

Country Status (1)

Country Link
CN (1) CN117351492A (en)

Similar Documents

Publication Publication Date Title
CN107633239B (en) Bill classification and bill field extraction method based on deep learning and OCR
CN110363102B (en) Object identification processing method and device for PDF (Portable document Format) file
JP6366024B2 (en) Method and apparatus for extracting text from an imaged document
CN110766014A (en) Bill information positioning method, system and computer readable storage medium
CN111476109A (en) Bill processing method, bill processing apparatus, and computer-readable storage medium
CN111027297A (en) Method for processing key form information of image type PDF financial data
CN113313111B (en) Text recognition method, device, equipment and medium
CN113569863B (en) Document checking method, system, electronic equipment and storage medium
CN111461133B (en) Express delivery surface single item name identification method, device, equipment and storage medium
CN112016481B (en) OCR-based financial statement information detection and recognition method
CN110751136A (en) Method for extracting value-added tax invoice information
US11436852B2 (en) Document information extraction for computer manipulation
CN112883926A (en) Identification method and device for table medical images
CN115909375A (en) Report form analysis method based on intelligent recognition
CN112949455A (en) Value-added tax invoice identification system and method
CN115620325A (en) Table structure restoration method and device, electronic equipment and storage medium
CN116030453A (en) Digital ammeter identification method, device and equipment
CN111340032A (en) Character recognition method based on application scene in financial field
CN108877030B (en) Image processing method, device, terminal and computer readable storage medium
CN114581928A (en) Form identification method and system
CN111738252A (en) Method and device for detecting text lines in image and computer system
WO2022082431A1 (en) Systems and methods for extracting information from paper media based on depth information
CN111914706B (en) Method and device for detecting and controlling quality of text detection output result
CN110298347B (en) Method for identifying automobile exhaust analyzer screen based on GrayWorld and PCA-CNN
CN115713775B (en) Method, system and computer equipment for extracting form from document

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination