WO2022105524A1 - 票据分类的方法、装置和计算机设备 - Google Patents

票据分类的方法、装置和计算机设备 Download PDF

Info

Publication number
WO2022105524A1
WO2022105524A1 PCT/CN2021/125228 CN2021125228W WO2022105524A1 WO 2022105524 A1 WO2022105524 A1 WO 2022105524A1 CN 2021125228 W CN2021125228 W CN 2021125228W WO 2022105524 A1 WO2022105524 A1 WO 2022105524A1
Authority
WO
WIPO (PCT)
Prior art keywords
bill
template
classified
specified
field
Prior art date
Application number
PCT/CN2021/125228
Other languages
English (en)
French (fr)
Inventor
王文浩
徐国强
Original Assignee
深圳壹账通智能科技有限公司
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 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2022105524A1 publication Critical patent/WO2022105524A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • the present application relates to the field of big data, in particular to a method, apparatus and computer equipment for bill classification.
  • the processing of bills by most small and medium-sized enterprises mainly relies on manual entry of bill information, and converts the content of paper bills into storable structured information.
  • Manual entry is not only inefficient and long-term, but also in high-intensity
  • OCR optical character recognition
  • the existing automatic classification model requires users to upload at least 15-20 pictures for each type of bills for model classification training. It is not easy to obtain a large number of bills of the same type, and the automatic and accurate classification of bills cannot be ensured.
  • the main purpose of this application is to provide bill classification and to solve the existing technical problem that the automatic and accurate classification of bills cannot be ensured.
  • This application proposes a method for classifying bills, including:
  • the field information includes character content of the field and coordinate information of the field
  • the character content of the field it is determined that the bill to be classified is the same specified field in the specified bill template, wherein the specified bill template is any bill template in the bill template database, and the specified field is the specified bill any field in the template;
  • each of the transformed coordinate information and the coordinate information of a field in the designated bill template respectively calculate the matching score of the bill to be classified and each of the bill templates;
  • the bill template corresponding to the minimum matching score is used as the classification template corresponding to the bill to be classified.
  • the present application also provides a device for classifying bills, including:
  • a first acquisition module used to acquire field information of the bill to be classified, wherein the field information includes the character content of the field and the coordinate information of the field;
  • a determination module configured to determine the same specified field in the bill to be classified and the specified bill template according to the character content of the field, wherein the specified bill template is any bill template in the bill template database, and the specified field for any field in the specified ticket template;
  • the first building module is configured to construct a structure according to the first coordinate information corresponding to all the designated fields in the bill to be classified, and the second coordinate information corresponding to all the designated fields in the designated bill template respectively. the transformation matrix between the bill to be classified and the specified bill template;
  • the second construction module is configured to construct transformation matrices corresponding to the bill to be classified and all the bill templates in the bill template database respectively according to the construction process of the transformation matrix between the bill to be classified and the designated bill template ;
  • a transmission transformation module configured to perform transmission transformation on the coordinate information of the fields of the bills to be classified through the transformation matrices corresponding to all the bill templates respectively, and obtain the transformed coordinate information of the bills to be classified corresponding to each bill template in a one-to-one correspondence;
  • a calculation module configured to calculate the matching scores of the bills to be classified and each of the bill templates according to the transformed coordinate information and the coordinate information of the fields in the designated bill template;
  • the first is as a module, which is used to use the bill template corresponding to the minimum matching score as the classification template corresponding to the bill to be classified.
  • the present application also provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements a method for classifying bills when the processor executes the computer program, and the method includes:
  • the field information includes character content of the field and coordinate information of the field
  • the character content of the field it is determined that the bill to be classified is the same specified field in the specified bill template, wherein the specified bill template is any bill template in the bill template database, and the specified field is the specified bill any field in the template;
  • each of the transformed coordinate information and the coordinate information of a field in the designated bill template respectively calculate the matching score of the bill to be classified and each of the bill templates;
  • the bill template corresponding to the minimum matching score is used as the classification template corresponding to the bill to be classified.
  • the present application also provides a computer-readable storage medium on which a computer program is stored.
  • a method for classifying notes is implemented, and the method includes:
  • the field information includes character content of the field and coordinate information of the field
  • the character content of the field it is determined that the bill to be classified is the same specified field in the specified bill template, wherein the specified bill template is any bill template in the bill template database, and the specified field is the specified bill any field in the template;
  • each of the transformed coordinate information and the coordinate information of a field in the designated bill template respectively calculate the matching score of the bill to be classified and each of the bill templates;
  • the bill template corresponding to the minimum matching score is used as the classification template corresponding to the bill to be classified.
  • the present application constructs a transformation matrix between the bill to be classified and the bill template through the coordinate information of the fields in the bill to be classified and the coordinate information of the corresponding field in the bill template, and performs transmission transformation through the transformation matrix to obtain the bill to be classified after the transmission transformation.
  • the coordinate information according to the coordinate information after the transformation and the coordinate information of the fields in the bill template, the matching score of the bill to be classified and the bill template is calculated, which avoids the training of the classification model and achieves fast and efficient bill classification.
  • FIG. 1 is a schematic flowchart of a method for classifying bills according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a system for classifying bills according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of an internal structure of a computer device according to an embodiment of the present application.
  • a method for classifying bills according to an embodiment of the present application includes:
  • S1 Acquire field information of the bill to be classified, wherein the field information includes character content of the field and coordinate information of the field;
  • S2 Determine the same specified field in the bill to be classified and the specified bill template according to the character content of the field, wherein the specified bill template is any bill template in the bill template database, and the specified field is the Specify any field in the ticket template;
  • S3 Construct the bill to be classified according to the first coordinate information corresponding to all the designated fields in the bill to be classified, and the second coordinate information corresponding to all the designated fields in the designated bill template respectively. a transformation matrix with the specified ticket template;
  • the field information of the bill is obtained through the field detection model and the field identification model
  • the field detection model is a pixel-level segmentation detection model based on a convolutional neural network CNN (Convolutional Neural Networks, convolutional neural network).
  • CNN Convolutional Neural Networks, convolutional neural network
  • the field recognition model is based on the CNN+CTC (Connectionist Temporal Classification) model, predicts the text sequence of the field according to the input bill picture, and then obtains the string of the field based on the CTC decoding rules, and then identifies the character content of the field.
  • CNN+CTC Connectionist Temporal Classification
  • the bill template of the embodiment of the present application is formed by different types of financial bills with clear pictures, standard printing, less background interference, and correct picture angles. Only one type of format needs to be selected as a bill template for frame selection and selection of reference fields. callout.
  • the above-mentioned reference fields include a flag field with a prominent layout, such as a note name and other fields with different character contents from other notes.
  • box-selecting and labeling the above reference fields try to select the scattered marked fields for standardization to improve the matching accuracy.
  • the above-mentioned frame selection and labeling process refers to the text box corresponding to the frame selection flag field, and the coordinate information corresponding to the label text box.
  • the field information of the bill to be classified is matched with the field information of the reference field in the template, and the matching score is calculated to effectively classify the bill to be classified.
  • the matching score is the ratio of the matching error to the number of completely matched fields, and the matching score
  • the template ticket corresponding to the smallest value is the ticket format or type corresponding to the ticket to be classified.
  • this application performs transmission transformation on the coordinate information of the fields, transforms the two-dimensional data into three-dimensional spatial display data, and performs panoramic stitching to improve the matching accuracy.
  • Each ticket template corresponds to a transformation matrix.
  • the coordinate information of the present application can be formed by taking the upper left corner of the upright bill as the coordinate origin, one side of the bill as the x-axis, and the other adjacent side as the y-axis to form a coordinate system to identify the text box of each field in the bill. Coordinate location.
  • the coordinate information of the field before the perspective transformation is expressed as (x, y)
  • the three-dimensional coordinate information of the field in the transformation is expressed as (X, Y, Z)
  • the coordinate information of the field after transformation is expressed as (x ⁇ , y ⁇ ).
  • the application pre-marks the corresponding relationship of four sets of mapping points, forms 12 linear equations, and solves the variables of the linear equation system composed of 12 linear equations through the least squares estimation, among which m11, m12, m13 ,m21,m22,m23,m31,m32,m33 are the variables of the linear equation system respectively, to approximately determine the values of m11,m12,m13,m21,m22,m23,m31,m32,m33, get the transformation matrix, and then It is also applicable to the transformation mapping of point coordinates other than the above-mentioned four sets of mapping points pre-marked.
  • the coordinate information before and after the transformation of the four groups of mapping points pre-marked above is known, for example, the coordinate values of the four vertex points of the square bill before and after the transformation.
  • the above transformation matrix is represented as (m11,m12,m13,m21,m22,m23,m31,m32,m33). which is
  • the z value before the transformation is 1, which is expressed as (x, y, 1), that is, the projection on the two-dimensional plane is (x, y), through the transformation
  • the matrix is transformed into a point (X, Y, Z) in a three-dimensional space, and then converted into a point (x ⁇ , y ⁇ ) in a two-dimensional plane by dividing by the value of the Z axis in the three-dimensional space, that is Then, the matching score is calculated by estimating the matching error between the transformed coordinate information c' of the field and the field coordinate information c in the bill template.
  • the present application constructs a transformation matrix between the bill to be classified and the bill template through the coordinate information of the fields in the bill to be classified and the coordinate information of the corresponding field in the bill template, and performs transmission transformation through the transformation matrix to obtain the bill to be classified after the transmission transformation.
  • the matching score of the bill to be classified and the bill template is calculated, which avoids the training of the classification model and achieves fast and efficient bill classification.
  • the classification model is used to classify bills. This application does not need to provide a large number of bill pictures of each format type for model training. It is more convenient to calculate the matching score between the bill to be classified and each bill template according to the formula. fast. Moreover, it has strong scalability. When a new bill template is added, it is only necessary to calculate the matching score between the bill to be classified and the newly added bill template, which is convenient for mobile terminal deployment and improves work efficiency.
  • the step S6 of calculating the matching score of the bill to be classified and each of the bill templates respectively includes:
  • S65 According to the calculation method of the matching score between the bill to be classified and the designated bill template, calculate the matching score of the bill to be classified and each of the bill templates respectively.
  • the matching error is first calculated when the matching score is calculated, and the matching score is comprehensively calculated according to the picture size of the bill template, the number of the same fields in the bill to be classified and the specified bill template, so that the size of the matching score is more accurate. Displays the evaluation accuracy of the same type of bills to be classified and bill templates, and in order to reduce the amount of calculation and improve the calculation accuracy, use as many scattered flag fields as possible in the bill template to participate in the calculation.
  • the transformed coordinate information of the bill to be classified corresponding to the designated bill template, and the coordinate information of the fields in the designated bill template calculate the relationship between the bill to be classified and the specified bill template.
  • the step S62 of describing the matching error of the designated bill template includes:
  • error indicates the matching error
  • (w,h) is the picture size corresponding to the specified bill template
  • w indicates the picture width
  • h indicates The height of the picture
  • c represents the coordinate information of the field in the designated bill template
  • c' represents the transformed coordinate information of the bill to be classified
  • S622 Run the first calculation formula to output the matching error between the bill to be classified and the specified bill template.
  • step S64 of calculating the matching score between the bill to be classified and the specified bill template according to the matching error and the number of identical fields includes:
  • step S642 of running the second calculation formula and outputting the matching score between the bill to be classified and the specified bill template includes:
  • the present application calculates a confidence score ranging from 0 to 100 according to the matching score.
  • the bill template with the smallest matching score is selected as the final classification template of the bill to be classified, and the corresponding confidence score is returned at the same time.
  • the matching scores are: score1 and score2, and score1 ⁇ score2, the confidence scores are: confidence1 and confidence2, then T1 is to be classified
  • the classification template corresponding to the bill has a confidence score of confidence1, and the confidence score of this application is above 90.
  • step S1 of acquiring the field information of the bills to be classified it includes:
  • S16 Mark the fields to be marked in each of the field sets correspondingly on each of the pre-selected samples according to a preset rule to form a bill template and store it in the bill template database.
  • the number of selected flag fields on each bill template is more than 8, and the differentiated fields with different characters are selected as the fields to be marked, that is, the flag fields.
  • All the identified fields in each bill template form a field set, and then comprehensively analyze the field sets corresponding to all the bill templates respectively, and calculate the repetition degree of the fields in the field sets corresponding to the bill templates respectively. For example, through character string comparison, it is ensured that the fields of each bill template and the fields of other bill templates have a duplication degree of no more than 50%. For example, if there are 8 fields to be marked, at least 4 or more fields are required. is a unique field in this ticket template. And in the field identification process, fields carrying various symbols, seals, icons, etc. are excluded to improve the field comparison accuracy.
  • the field set includes the character content of the field and the coordinate information of the field, and the fields to be marked in each of the field sets are correspondingly marked on each of the preselected samples according to preset rules to form a bill template.
  • the step S16 stored in the ticket template database includes:
  • S162 According to the coordinate information of the field, determine whether the predetermined number of equally divided regions of the specified preselected samples contain at least one corresponding field to be marked in the specified field set;
  • S164 Mark each of the pre-selected samples respectively according to the labeling method of the designated pre-selected samples, and form a bill template corresponding to each of the pre-selected samples;
  • S165 Store the bill templates corresponding to each of the preselected samples in the bill template database.
  • the repeated fields can be deleted from the field set according to the requirements of repetition degree, and the fields that meet the requirements of repetition degree can be reserved, and then the reserved fields to be marked can be reserved according to the requirements of repetition degree.
  • Fields are re-screened by scattered location information in each ticket template to achieve decentralized labeling.
  • the above-mentioned preset number of equally divided areas is not specifically limited. For example, this application divides the page of the bill template into four areas according to the width and height of each bill template, and according to the coordinates of the text box of the field to be marked Position and coordinate information of each area, ensure that each area in the page contains at least one text box for the field to be marked.
  • the above-mentioned four areas include the intersection of two mutually perpendicular dividing lines at the center point, four areas divided by the two dividing points, and four equally divided areas divided by three parallel dividing lines.
  • an apparatus for classifying bills includes:
  • the first acquisition module 1 is used to acquire field information of the bill to be classified, wherein the field information includes the character content of the field and the coordinate information of the field;
  • a determination module 2 configured to determine the same specified field in the bill to be classified and the specified bill template according to the character content of the field, wherein the specified bill template is any bill template in the bill template database, and the specified bill template is The field is any field in the specified ticket template;
  • the first building module 3 is used to respectively correspond to the first coordinate information in the bill to be classified according to all the specified fields, and all the specified fields correspond to the second coordinate information in the specified bill template respectively, constructing a transformation matrix between the bill to be classified and the specified bill template;
  • the second construction module 4 is configured to construct transformations corresponding to the bill to be classified and all the bill templates in the bill template database respectively according to the construction process of the transformation matrix between the bill to be classified and the specified bill template matrix;
  • the transmission transformation module 5 is configured to perform transmission transformation on the coordinate information of the fields of the bills to be classified through the transformation matrices corresponding to all the bill templates respectively, and obtain the transformed coordinate information of the bills to be classified corresponding to each bill template in a one-to-one correspondence;
  • a calculation module 6 configured to calculate the matching score of the bill to be classified and each of the bill templates according to the coordinate information after each transformation and the coordinate information of the fields in the designated bill template;
  • the first is module 7, which is used to use the bill template corresponding to the minimum matching score as the classification template corresponding to the bill to be classified.
  • calculation module 6 includes:
  • a first obtaining unit configured to obtain the picture size corresponding to the designated ticket template
  • the first calculation unit is configured to calculate the to-be-sorted bill according to the picture size corresponding to the specified bill template, the transformed coordinate information of the bill to be classified corresponding to the specified bill template, and the coordinate information of the fields in the specified bill template. The matching error between the classified bill and the specified bill template;
  • a second calculation unit configured to calculate the matching score between the bill to be classified and the specified bill template according to the matching error and the number of identical fields
  • the third calculation unit is configured to calculate the matching score of the bill to be classified and each of the bill templates according to the calculation method of the matching score of the bill to be classified and the designated bill template.
  • the first computing unit includes:
  • the first input subunit is used to input the image size corresponding to the designated bill template, the transformed coordinate information of the bill to be classified corresponding to the designated bill template, and the coordinate information of the fields in the bill to be classified, into the input sub-unit.
  • the first running subunit is configured to run the first calculation formula and output the matching error between the bill to be classified and the specified bill template.
  • the second computing unit includes:
  • the second running subunit is configured to run the second calculation formula and output the matching score between the bill to be classified and the specified bill template.
  • the second computing unit includes:
  • the third running subunit is configured to run the third calculation formula, and output the confidence score of the matching score between the bill to be classified and the specified bill template.
  • the apparatus for classifying bills includes:
  • the second acquisition module is used to acquire preselected samples corresponding to various types of bills
  • a detection module configured to input each of the pre-selected samples into a field detection and recognition model, and detect the field sets corresponding to each of the pre-selected samples
  • a judgment module for judging whether the field repetition degree in each of the field sets is greater than or equal to a preset repetition degree threshold
  • a deletion module configured to delete the repeated fields in each of the field sets if it is greater than or equal to a preset repetition degree threshold, until the field repetition degree in each of the field sets is less than the preset repetition degree threshold;
  • the second is as a module, which is used to use the remaining fields in each of the field sets as the fields to be marked;
  • the forming module is used for correspondingly marking the fields to be marked in each of the field sets on each of the pre-selected samples according to preset rules to form a bill template and store it in the bill template database.
  • the field set includes the character content of the field and the coordinate information of the field, forming a module, including:
  • a second acquiring unit configured to acquire the specified preselected samples corresponding to the specified field set
  • a judging unit configured to judge, according to the coordinate information of the field, whether the predetermined number of equally divided regions of the specified preselected samples contain at least one corresponding field to be marked in the specified field set;
  • a first labeling unit configured to label the to-be-labeled field on the specified pre-selected sample if at least one corresponding field to be labeled in the specified field set is included to form a bill corresponding to the specified pre-selected sample template
  • a second labeling unit configured to label each of the pre-selected samples according to the labeling method of the designated pre-selected samples, to form a bill template corresponding to each of the pre-selected samples
  • the storage unit is configured to store the bill templates corresponding to each of the preselected samples in the bill template database.
  • an embodiment of the present application further provides a computer device
  • the computer device may be a server, and its internal structure may be as shown in Fig. 3.
  • the computer device includes a processor, memory, a network interface, and a database connected by a system bus.
  • the processor of the computer design is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium, an internal memory.
  • the nonvolatile storage medium stores an operating system, a computer program, and a database.
  • the memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium.
  • the database of the computer equipment is used to store all the data required for the process of sorting tickets.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • FIG. 3 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied.
  • An embodiment of the present application further provides a computer-readable storage medium, which may be non-volatile or volatile, on which a computer program is stored, and when the computer program is executed by a processor, implements any of the foregoing embodiments.
  • a method of classifying notes may be non-volatile or volatile, on which a computer program is stored, and when the computer program is executed by a processor, implements any of the foregoing embodiments.
  • Nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Mathematical Physics (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Multimedia (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请涉及大数据领域,揭示了票据分类的方法,包括:获取待分类票据的字段信息;根据字段的字符内容确定待分类票据与指定票据模板中相同的指定字段;根据所有指定字段分别对应在待分类票据中的第一坐标信息,以及所有指定字段分别对应在指定票据模板中的第二坐标信息,构建待分类票据与指定票据模板之间的变换矩阵,构建所有票据模板分别对应的变换矩阵;通过所有票据模板分别对应的变换矩阵分别对待分类票据字段的坐标信息进行透射变换,一一对应得到变换后坐标信息;根据各变换后坐标信息与指定票据模板中字段的坐标信息,分别计算待分类票据与各票据模板的匹配得分;将匹配得分最小值对应的票据模板,作为待分类票据对应的分类模板。

Description

票据分类的方法、装置和计算机设备
本申请要求于2020年11月17日提交中国专利局、申请号为2020112877607,发明名称为“票据分类的方法、装置和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及大数据领域,特别是涉及到票据分类的方法、装置和计算机设备。
背景技术
目前多数中小企业对于票据的处理主要依赖于人工手动进行票据信息的录入,将纸质票据中的内容转化为可存储的结构化信息,通过人工录入方式不仅效率低、周期长,而且在高强度重复工作压力下难免精神懈怠导致工作错误,不能满足对票据信息管理效率和智能化的追求。虽可通过光学字符识别(OCR)技术,借助自动分类模型实现票据自动分类到模版库中。但发明人发现,现有自动分类模型需要用户对每一类票据至少上传15-20张图片进行模型分类训练,要获得大量相同类型的票据并不容易,无法确保票据的自动化精准分类。
技术问题
本申请的主要目的为提供票据分类的,旨在解决现有无法确保票据的自动化精准分类的技术问题。
技术解决方案
本申请提出一种票据分类的方法,包括:
获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
本申请还提供了一种票据分类的装置,包括:
第一获取模块,用于获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
确定模块,用于根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
第一构建模块,用于根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
第二构建模块,用于根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
透射变换模块,用于通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
计算模块,用于根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
第一作为模块,用于将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
本申请还提供了一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现一种票据分类的方法,所述方法包括:
获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现一种票据分类的方法,所述方法包括:
获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
有益效果
本申请通过待分类票据中字段的坐标信息,以及票据模板中相应字段的坐标信息,构 建待分类票据与票据模板之间的变换矩阵,并通过变换矩阵进行透射变换,得到待分类票据经过透射变换后的坐标信息,根据变换后坐标信息与票据模板中字段的坐标信息,计算待分类票据与票据模板的匹配得分,避免了分类模型的训练,达到了快速高效的票据分类。
附图说明
图1本申请一实施例的票据分类的方法流程示意图;
图2本申请一实施例的票据分类的系统流程示意图;
图3本申请一实施例的计算机设备内部结构示意图。
本发明的最佳实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
参照图1,本申请一实施例的票据分类的方法,包括:
S1:获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
S2:根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
S3:根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
S4:根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
S5:通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
S6:根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
S7:将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
本申请实施例中,通过字段检测模型以及字段识别模型获取票据的字段信息,字段检测模型是基于卷积神经网络CNN(Convolutional Neural Networks,卷积神经网络)的像素级分割的检测模型,对输入票据图片的像素进行分类,区分出票据中的文字区域和背景区域,然后再通过连通域分析聚合得到字段对应的文本框,进而确定该字段处于票据中的坐标信息。字段识别模型基于CNN+CTC(Connectionist Temporal Classification,连接时序分类)的模型,根据输入的票据图片预测字段的文字序列,再基于CTC解码规则得到字段的字符串,进而识别得到字段的字符内容。
本申请实施例的票据模板,由图片清晰、打印标准、背景干扰少、图片角度端正的不同类版式的财务票据形成,每类版式只需选定一张作为票据模板进行参考字段的框选和标注。上述参考字段包括凸显版式的标志字段,比如票据名称等与其他票据中具有不同字符内容的字段。在框选和标注上述参考字段时,尽可能选择分散分布的标志字段进行标准,提高匹配精准度。上述框选和标注过程指框选标志字段对应的文本框,标注文本框对应的坐标信息。
本申请实施例通过将待分类票据的字段信息与模板中的参考字段的字段信息进行匹配,并计算匹配得分对待分类票据进行有效分类,匹配得分为匹配误差与完全匹配字段数量的比值,匹配得分最小时对应的模板票据即为待分类票据对应的票据版式或类型。本申请为提高匹配精准度,避免票据尺寸差异等因素影响匹配效果,对字段的坐标信息进行了透射变换,将二维数据变换成三维的空间展示数据,并进行全景拼接,提高匹配的精准度。每 一个票据模板对应一个变换矩阵。本申请的坐标信息可通过以端正放置的票据的左上角为坐标原点,票据的一条边为x轴,相邻的另一条边为y轴形成坐标系,以标识票据中各字段的文本框的坐标位置。举例地,透视变换前一字段的坐标信息表示为(x,y),变换中该字段的三维坐标信息表示为(X,Y,Z),该字段变换后的坐标信息表示为(x`,y`)。根据变换前后的坐标信息构建线性方程X=m11x+m12y+m13、Y=m21x+m22y+m23以及Z=m31x+m32y+m33。本申请为提高计算精准度,预先标注四组映射点的对应关系,形成12个线性方程,并通过最小二乘法估算求解出12个线性方程组成的线性方程组的变量,其中m11,m12,m13,m21,m22,m23,m31,m32,m33分别为线性方程组的变量,以近似确定出m11,m12,m13,m21,m22,m23,m31,m32,m33的取值,得到变换矩阵,然后再适用于除上述预先标注四组映射点之外的点坐标的变换映射。上述预先标注四组映射点变换前后的坐标信息为已知的,比如为变换前后方形票据的四个顶角点的坐标值。上述变换矩阵表示为(m11,m12,m13,m21,m22,m23,m31,m32,m33)。即
Figure PCTCN2021125228-appb-000001
假设除上述预先标注四组映射点之外的点,在变换之前的z值为1,表示为(x,y,1),即在二维平面上的投影是(x,y),通过变换矩阵变换成三维空间中的点(X,Y,Z),再通过除以三维空间中Z轴的值,变换后转换成二维平面中的点(x`,y`),即
Figure PCTCN2021125228-appb-000002
然后通过估算变换后的该字段的坐标信息c`与票据模板中的字段坐标信息c之间的匹配误差,进而计算出匹配得分。
本申请通过待分类票据中字段的坐标信息,以及票据模板中相应字段的坐标信息,构建待分类票据与票据模板之间的变换矩阵,并通过变换矩阵进行透射变换,得到待分类票据经过透射变换后的坐标信息,根据变换后坐标信息与票据模板中字段的坐标信息,计算待分类票据与票据模板的匹配得分,避免了分类模型的训练,达到了快速高效的票据分类,相比于之前基于分类模型进行票据分类,本申请不需要提供大量的每一版式类型的票据图片用于模型训练,只需根据公式计算待分类票据与每张票据模板之间的匹配得分即可实现分类,更方便快捷。而且可扩展性强,当新增票据模版时,只需再计算待分类票据与新增票据模版间的匹配得分即可,方便移动端部署,并提高工作效率。
进一步地,所述根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分的步骤S6,包括:
S61:获取所述指定票据模板对应的图片尺寸;
S62:根据所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及指定票据模板中字段的坐标信息,计算所述待分类票据与所述指定票据模板的匹配误差;
S63:统计所述待分类票据与所述指定票据模板中相同字段的数量;
S64:根据所述匹配误差以及相同字段的数量,计算所述待分类票据与所述指定票据模板的匹配得分;
S65:根据所述待分类票据与所述指定票据模板的匹配得分的计算方式,分别计算所述待分类票据与各所述票据模板的匹配得分。
本申请实施例中,计算匹配得分时先计算匹配误差,并依据票据模板的图片尺寸、待分类票据与所述指定票据模板中相同字段的数量,综合计算匹配得分,使匹配得分的大小更能显示待分类票据与票据模板的类型一致的评价精准性,且为减少计算量提高计算精度,采用票据模板中尽量多的分散分布的标志字段参与计算。
进一步地,根据所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及指定票据模板中字段的坐标信息,计算所述待分类票据与所述指定票据模板的匹配误差的步骤S62,包括:
S621:将所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及所述待分类票据中字段的坐标信息,输入第一计算公式,其中,所述第一计算公式为error=|c-c`|/min(w,h),error表示匹配误差,(w,h)为所述指定票据模板对应的图片尺寸,w表示图片宽度,h表示图片高度,c表示所述指定票据模板中字段的坐标信息,c`表示所述待分类票据对应于所述指定票据模板的变换后坐标信息;
S622:运行所述第一计算公式,输出所述待分类票据与所述指定票据模板的匹配误差。
进一步地,所述根据所述匹配误差以及相同字段的数量,计算所述待分类票据与所述指定票据模板的匹配得分的步骤S64,包括:
S641:将所述匹配误差以及相同字段的数量,输入第二计算公式,其中,所述第二计算公式为score=error/loge(matched_num),score表示匹配得分,matched_num表示相同字段的数量;
S642:运行所述第二计算公式,输出所述待分类票据与所述指定票据模板的匹配得分。
进一步地,所述运行所述第二计算公式,输出所述待分类票据与所述指定票据模板的匹配得分的步骤S642之后,包括:
S643:将所述匹配得分输入第三计算公式,其中,所述第三计算公式为confidence=softmax(-score*200),confidence表示置信度得分;
S644:运行所述第三计算公式,输出所述待分类票据与所述指定票据模板的匹配得分的置信度得分。
本申请在计算匹配得分后,根据该匹配得分计算出一个取值在0至100之间的置信度得分。选取匹配得分最小的票据模版作为该待分类票据最终的分类模版,同时返回相应的置信度得分。例如:待分类票据I与两张不同的票据模版的图片T1、T2之间,匹配得分分别为:score1和score2,且score1<score2,置信度得分分别为:confidence1和confidence2,则T1为待分类票据对应的分类模版,置信度得分为confidence1,本申请的置信度得分在90以上。
进一步地,所述获取待分类票据的字段信息的步骤S1之前,包括:
S11:获取各类型票据分别对应的预选定样本;
S12:将各所述预选定样本输入字段检测识别模型中,检测各所述预选定样本分别对应的字段集合;
S13:判断各所述字段集合中的字段重复度,是否大于或等于预设重复度阈值;
S14:若是,则删除各所述字段集合中的重复字段,至各所述字段集合中的字段重复度小于所述预设重复度阈值;
S15:将各所述字段集合中的剩余字段,作为待标注字段;
S16:将各所述字段集合中的待标注字段,按照预设规则对应标注在各所述预选定样本上,形成票据模板存储于所述票据模板数据库中。
本申请在制作票据模板的过程中,每个票据模板上选定的标志字段的数量为8个以上,且筛选字符不同的差异化字段作为待标注字段,即标志字段。每个票据模板中所有识别到的字段形成字段集合,然后将所有票据模板分别对应的字段集合进行综合分析,计算票据模板分别对应的字段集合中字段的重复度。举例地,通过字符串比对,保证每个票据模版的字段与其他票据模版的字段,重复度不超过50%,比如待标注的字段为8个,则至少其中4个或4个以上的字段是该票据模版中的特有字段。且在字段识别过程中,排除携带各种符号、印章、图标等的字段,以提高字段比对精准度。
进一步地,所述字段集合包括字段的字符内容以及字段的坐标信息,所述将各所述字段集合中的待标注字段,按照预设规则对应标注在各所述预选定样本上,形成票据模板存储于所述票据模板数据库中的步骤S16,包括:
S161:获取指定字段集合对应的指定预选定样本;
S162:根据字段的坐标信息,判断所述指定预选定样本的预设数量的均分区域中,是否至少包含一个所述指定字段集合中对应的待标注字段;
S163:若是,则将所述待标注字段标注在所述指定预选定样本上,形成所述指定预选定样本对应的票据模板;
S164:根据所述指定预选定样本的标注方式,分别标注各所述预选定样本,形成各所述预选定样本分别对应的票据模板;
S165:将各所述预选定样本分别对应的票据模板存储于所述票据模板数据库中。
本申请在筛选每个票据模板对应的标志字段时,可先根据重复度的要求将多次重复的字段从字段集合中删除,预留满足重复度要求的字段,然后再根据保留下的待标注字段在每张票据模版中分散位置信息进行再次筛选,以实现分散化标注。上述预设数量的均分区域不作具体限定,举例地,本申请根据每张票据模版的宽和高,将票据模板的页面均分为四块区域,根据待标注字段的文本框所处的坐标位置与每一块区域的坐标信息,确保页面中每一分块区域内至少包含一个待标注字段的文本框。上述四块区域包括以中心点为相互垂直的两条分界线的交点,通过两条分界点划分得到的四个区域,也包括通过三条平行的分界线,划分得到的四个均分区域。
参照图2,本申请一实施例的票据分类的装置,包括:
第一获取模块1,用于获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
确定模块2,用于根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
第一构建模块3,用于根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
第二构建模块4,用于根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
透射变换模块5,用于通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
计算模块6,用于根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
第一作为模块7,用于将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
本申请装置部分的实施例解释,同方法部分,不赘述。
进一步地,计算模块6,包括:
第一获取单元,用于获取所述指定票据模板对应的图片尺寸;
第一计算单元,用于根据所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及指定票据模板中字段的坐标信息,计算所述待分类票据与所述指定票据模板的匹配误差;
统计单元,用于统计所述待分类票据与所述指定票据模板中相同字段的数量;
第二计算单元,用于根据所述匹配误差以及相同字段的数量,计算所述待分类票据与所述指定票据模板的匹配得分;
第三计算单元,用于根据所述待分类票据与所述指定票据模板的匹配得分的计算方式,分别计算所述待分类票据与各所述票据模板的匹配得分。
进一步地,第一计算单元,包括:
第一输入子单元,用于将所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及所述待分类票据中字段的坐标信息,输入第一计算公式,其中,所述第一计算公式为error=|c-c`|/min(w,h),error表示匹配误差,(w,h)为所述指定票据模板对应的图片尺寸,w表示图片宽度,h表示图片高度,c表示所述指定票据模板中字段的坐标信息,c`表示所述待分类票据对应于所述指定票据模板的变换后坐标信息;
第一运行子单元,用于运行所述第一计算公式,输出所述待分类票据与所述指定票据模板的匹配误差。
进一步地,第二计算单元,包括:
第二输入子单元,用于将所述匹配误差以及相同字段的数量,输入第二计算公式,其中,所述第二计算公式为score=error/loge(matched_num),score表示匹配得分,matched_num表示相同字段的数量;
第二运行子单元,用于运行所述第二计算公式,输出所述待分类票据与所述指定票据模板的匹配得分。
进一步地,第二计算单元包括:
第三输入子单元,用于将所述匹配得分输入第三计算公式,其中,所述第三计算公式为confidence=softmax(-score*200),confidence表示置信度得分;
第三运行子单元,用于运行所述第三计算公式,输出所述待分类票据与所述指定票据模板的匹配得分的置信度得分。
进一步地,票据分类的装置,包括:
第二获取模块,用于获取各类型票据分别对应的预选定样本;
检测模块,用于将各所述预选定样本输入字段检测识别模型中,检测各所述预选定样本分别对应的字段集合;
判断模块,用于判断各所述字段集合中的字段重复度,是否大于或等于预设重复度阈值;
删除模块,用于若大于或等于预设重复度阈值,则删除各所述字段集合中的重复字段,至各所述字段集合中的字段重复度小于所述预设重复度阈值;
第二作为模块,用于将各所述字段集合中的剩余字段,作为待标注字段;
形成模块,用于将各所述字段集合中的待标注字段,按照预设规则对应标注在各所述预选定样本上,形成票据模板存储于所述票据模板数据库中。
进一步地,所述字段集合包括字段的字符内容以及字段的坐标信息,形成模块,包括:
第二获取单元,用于获取指定字段集合对应的指定预选定样本;
判断单元,用于根据字段的坐标信息,判断所述指定预选定样本的预设数量的均分区域中,是否至少包含一个所述指定字段集合中对应的待标注字段;
第一标注单元,用于若至少包含一个所述指定字段集合中对应的待标注字段,则将所述待标注字段标注在所述指定预选定样本上,形成所述指定预选定样本对应的票据模板;
第二标注单元,用于根据所述指定预选定样本的标注方式,分别标注各所述预选定样本,形成各所述预选定样本分别对应的票据模板;
存储单元,用于将各所述预选定样本分别对应的票据模板存储于所述票据模板数据库中。
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其 内部结构可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储票据分类的过程需要的所有数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现上述任一实施例中的票据分类的方法。
本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定。
本申请一实施例还提供一种计算机可读存储介质,可以是非易失性,也可以是易失性,其上存储有计算机程序,计算机程序被处理器执行时实现上述任一实施例中的票据分类的方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,上述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的和实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可以包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双速据率SDRAM(SSRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种票据分类的方法,其中,包括:
    获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
    根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
    根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
    根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
    通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
    根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
    将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
  2. 根据权利要求1所述的票据分类的方法,其中,所述根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分的步骤,包括:
    获取所述指定票据模板对应的图片尺寸;
    根据所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及指定票据模板中字段的坐标信息,计算所述待分类票据与所述指定票据模板的匹配误差;
    统计所述待分类票据与所述指定票据模板中相同字段的数量;
    根据所述匹配误差以及相同字段的数量,计算所述待分类票据与所述指定票据模板的匹配得分;
    根据所述待分类票据与所述指定票据模板的匹配得分的计算方式,分别计算所述待分类票据与各所述票据模板的匹配得分。
  3. 根据权利要求2所述的票据分类的方法,其中,所述根据所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及指定票据模板中字段的坐标信息,计算所述待分类票据与所述指定票据模板的匹配误差的步骤,包括:
    将所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及所述待分类票据中字段的坐标信息,输入第一计算公式,其中,所述第一计算公式为error=|c-c`|/min(w,h),error表示匹配误差,(w,h)为所述指定票据模板对应的图片尺寸,w表示图片宽度,h表示图片高度,c表示所述指定票据模板中字段的坐标信息,c`表示所述待分类票据对应于所述指定票据模板的变换后坐标信息;
    运行所述第一计算公式,输出所述待分类票据与所述指定票据模板的匹配误差。
  4. 根据权利要求2所述的票据分类的方法,其中,所述根据所述匹配误差以及相同字段的数量,计算所述待分类票据与所述指定票据模板的匹配得分的步骤,包括:
    将所述匹配误差以及相同字段的数量,输入第二计算公式,其中,所述第二计算公式为score=error/loge(matched_num),score表示匹配得分,matched_num表示相同字段的数量;
    运行所述第二计算公式,输出所述待分类票据与所述指定票据模板的匹配得分。
  5. 根据权利要求4所述的票据分类的方法,其中,所述运行所述第二计算公式,输出所述待分类票据与所述指定票据模板的匹配得分的步骤之后,包括:
    将所述匹配得分输入第三计算公式,其中,所述第三计算公式为confidence=softmax(-score*200),confidence表示置信度得分;
    运行所述第三计算公式,输出所述待分类票据与所述指定票据模板的匹配得分的置信度得分。
  6. 根据权利要求1所述的票据分类的方法,其中,所述获取待分类票据的字段信息的步骤之前,包括:
    获取各类型票据分别对应的预选定样本;
    将各所述预选定样本输入字段检测识别模型中,检测各所述预选定样本分别对应的字段集合;
    判断各所述字段集合中的字段重复度,是否大于或等于预设重复度阈值;
    若是,则删除各所述字段集合中的重复字段,至各所述字段集合中的字段重复度小于所述预设重复度阈值;
    将各所述字段集合中的剩余字段,作为待标注字段;
    将各所述字段集合中的待标注字段,按照预设规则对应标注在各所述预选定样本上,形成票据模板存储于所述票据模板数据库中。
  7. 根据权利要求6所述的票据分类的方法,其中,所述字段集合包括字段的字符内容以及字段的坐标信息,所述将各所述字段集合中的待标注字段,按照预设规则对应标注在各所述预选定样本上,形成票据模板存储于所述票据模板数据库中的步骤,包括:
    获取指定字段集合对应的指定预选定样本;
    根据字段的坐标信息,判断所述指定预选定样本的预设数量的均分区域中,是否至少包含一个所述指定字段集合中对应的待标注字段;
    若是,则将所述待标注字段标注在所述指定预选定样本上,形成所述指定预选定样本对应的票据模板;
    根据所述指定预选定样本的标注方式,分别标注各所述预选定样本,形成各所述预选定样本分别对应的票据模板;
    将各所述预选定样本分别对应的票据模板存储于所述票据模板数据库中。
  8. 一种票据分类的装置,其中,包括:
    第一获取模块,用于获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
    确定模块,用于根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
    第一构建模块,用于根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
    第二构建模块,用于根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
    透射变换模块,用于通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
    计算模块,用于根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
    第一作为模块,用于将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
  9. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其中,所述处理器执行所述计算机程序时实现一种票据分类的方法,所述方法包括:
    获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
    根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
    根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
    根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
    通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
    根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
    将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
  10. 根据权利要求9所述的计算机设备,其中,所述根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分的步骤,包括:
    获取所述指定票据模板对应的图片尺寸;
    根据所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及指定票据模板中字段的坐标信息,计算所述待分类票据与所述指定票据模板的匹配误差;
    统计所述待分类票据与所述指定票据模板中相同字段的数量;
    根据所述匹配误差以及相同字段的数量,计算所述待分类票据与所述指定票据模板的匹配得分;
    根据所述待分类票据与所述指定票据模板的匹配得分的计算方式,分别计算所述待分类票据与各所述票据模板的匹配得分。
  11. 根据权利要求10所述的计算机设备,其中,所述根据所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及指定票据模板中字段的坐标信息,计算所述待分类票据与所述指定票据模板的匹配误差的步骤,包括:
    将所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及所述待分类票据中字段的坐标信息,输入第一计算公式,其中,所述第一计算公式为error=|c-c`|/min(w,h),error表示匹配误差,(w,h)为所述指定票据模板对应的图片尺寸,w表示图片宽度,h表示图片高度,c表示所述指定票据模板中字段的坐标信息,c`表示所述待分类票据对应于所述指定票据模板的变换后坐标信息;
    运行所述第一计算公式,输出所述待分类票据与所述指定票据模板的匹配误差。
  12. 根据权利要求10所述的计算机设备,其中,所述根据所述匹配误差以及相同字段的数量,计算所述待分类票据与所述指定票据模板的匹配得分的步骤,包括:
    将所述匹配误差以及相同字段的数量,输入第二计算公式,其中,所述第二计算公式为score=error/loge(matched_num),score表示匹配得分,matched_num表示相同字段的数量;
    运行所述第二计算公式,输出所述待分类票据与所述指定票据模板的匹配得分。
  13. 根据权利要求12所述的计算机设备,其中,所述运行所述第二计算公式,输出所述待分类票据与所述指定票据模板的匹配得分的步骤之后,包括:
    将所述匹配得分输入第三计算公式,其中,所述第三计算公式为confidence=softmax(-score*200),confidence表示置信度得分;
    运行所述第三计算公式,输出所述待分类票据与所述指定票据模板的匹配得分的置信度得分。
  14. 根据权利要求9所述的计算机设备,其中,所述获取待分类票据的字段信息的步骤之前,包括:
    获取各类型票据分别对应的预选定样本;
    将各所述预选定样本输入字段检测识别模型中,检测各所述预选定样本分别对应的字段集合;
    判断各所述字段集合中的字段重复度,是否大于或等于预设重复度阈值;
    若是,则删除各所述字段集合中的重复字段,至各所述字段集合中的字段重复度小于所述预设重复度阈值;
    将各所述字段集合中的剩余字段,作为待标注字段;
    将各所述字段集合中的待标注字段,按照预设规则对应标注在各所述预选定样本上,形成票据模板存储于所述票据模板数据库中。
  15. 一种计算机可读存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现一种票据分类的方法,所述包括:
    获取待分类票据的字段信息,其中,所述字段信息包括字段的字符内容和字段的坐标信息;
    根据所述字段的字符内容确定所述待分类票据与指定票据模板中相同的指定字段,其中,所述指定票据模板为票据模板数据库中的任意一个票据模板,所述指定字段为所述指定票据模板中的任一字段;
    根据所有所述指定字段分别对应在所述待分类票据中的第一坐标信息,以及所有所述指定字段分别对应在所述指定票据模板中的第二坐标信息,构建所述待分类票据与所述指定票据模板之间的变换矩阵;
    根据所述待分类票据与所述指定票据模板之间的变换矩阵的构建过程,构建所述待分类票据与所述票据模板数据库中的所有票据模板分别对应的变换矩阵;
    通过所有票据模板分别对应的变换矩阵分别对所述待分类票据字段的坐标信息进行透射变换,一一对应得到所述待分类票据对应各票据模板的变换后坐标信息;
    根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分;
    将匹配得分最小值对应的票据模板,作为所述待分类票据对应的分类模板。
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述根据各所述变换后坐标信息与所述指定票据模板中字段的坐标信息,分别计算所述待分类票据与各所述票据模板的匹配得分的步骤,包括:
    获取所述指定票据模板对应的图片尺寸;
    根据所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及指定票据模板中字段的坐标信息,计算所述待分类票据与所述指定票据模板的匹配误差;
    统计所述待分类票据与所述指定票据模板中相同字段的数量;
    根据所述匹配误差以及相同字段的数量,计算所述待分类票据与所述指定票据模板的匹配得分;
    根据所述待分类票据与所述指定票据模板的匹配得分的计算方式,分别计算所述待分类票据与各所述票据模板的匹配得分。
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述根据所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及指定 票据模板中字段的坐标信息,计算所述待分类票据与所述指定票据模板的匹配误差的步骤,包括:
    将所述指定票据模板对应的图片尺寸、所述待分类票据对应于所述指定票据模板的变换后坐标信息,以及所述待分类票据中字段的坐标信息,输入第一计算公式,其中,所述第一计算公式为error=|c-c`|/min(w,h),error表示匹配误差,(w,h)为所述指定票据模板对应的图片尺寸,w表示图片宽度,h表示图片高度,c表示所述指定票据模板中字段的坐标信息,c`表示所述待分类票据对应于所述指定票据模板的变换后坐标信息;
    运行所述第一计算公式,输出所述待分类票据与所述指定票据模板的匹配误差。
  18. 根据权利要求16所述的计算机可读存储介质,其中,所述根据所述匹配误差以及相同字段的数量,计算所述待分类票据与所述指定票据模板的匹配得分的步骤,包括:
    将所述匹配误差以及相同字段的数量,输入第二计算公式,其中,所述第二计算公式为score=error/loge(matched_num),score表示匹配得分,matched_num表示相同字段的数量;
    运行所述第二计算公式,输出所述待分类票据与所述指定票据模板的匹配得分。
  19. 根据权利要求18所述的计算机可读存储介质,其中,所述运行所述第二计算公式,输出所述待分类票据与所述指定票据模板的匹配得分的步骤之后,包括:
    将所述匹配得分输入第三计算公式,其中,所述第三计算公式为confidence=softmax(-score*200),confidence表示置信度得分;
    运行所述第三计算公式,输出所述待分类票据与所述指定票据模板的匹配得分的置信度得分。
  20. 根据权利要求15所述的计算机可读存储介质,其中,所述获取待分类票据的字段信息的步骤之前,包括:
    获取各类型票据分别对应的预选定样本;
    将各所述预选定样本输入字段检测识别模型中,检测各所述预选定样本分别对应的字段集合;
    判断各所述字段集合中的字段重复度,是否大于或等于预设重复度阈值;
    若是,则删除各所述字段集合中的重复字段,至各所述字段集合中的字段重复度小于所述预设重复度阈值;
    将各所述字段集合中的剩余字段,作为待标注字段;
    将各所述字段集合中的待标注字段,按照预设规则对应标注在各所述预选定样本上,形成票据模板存储于所述票据模板数据库中。
PCT/CN2021/125228 2020-11-17 2021-10-21 票据分类的方法、装置和计算机设备 WO2022105524A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011287760.7 2020-11-17
CN202011287760.7A CN112381153A (zh) 2020-11-17 2020-11-17 票据分类的方法、装置和计算机设备

Publications (1)

Publication Number Publication Date
WO2022105524A1 true WO2022105524A1 (zh) 2022-05-27

Family

ID=74584013

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/125228 WO2022105524A1 (zh) 2020-11-17 2021-10-21 票据分类的方法、装置和计算机设备

Country Status (2)

Country Link
CN (1) CN112381153A (zh)
WO (1) WO2022105524A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117132460A (zh) * 2023-09-12 2023-11-28 上海世禹精密设备股份有限公司 视觉检测标准图的生成方法、装置、电子设备及存储介质
CN117315705A (zh) * 2023-10-10 2023-12-29 河北神玥软件科技股份有限公司 通用的卡证识别方法、装置、系统、电子设备及存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112381153A (zh) * 2020-11-17 2021-02-19 深圳壹账通智能科技有限公司 票据分类的方法、装置和计算机设备
CN113780116A (zh) * 2021-08-26 2021-12-10 众安在线财产保险股份有限公司 发票分类方法、装置、计算机设备和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120051649A1 (en) * 2010-09-01 2012-03-01 Xerox Corporation Finding low variance regions in document images for generating image anchor templates for content anchoring, data extraction, and document classification
CN109740417A (zh) * 2018-10-29 2019-05-10 深圳壹账通智能科技有限公司 发票类型识别方法、装置、存储介质和计算机设备
CN110569850A (zh) * 2019-08-20 2019-12-13 北京旷视科技有限公司 字符识别模板匹配方法、装置和文本识别设备
CN111046736A (zh) * 2019-11-14 2020-04-21 贝壳技术有限公司 一种提取文本信息的方法、装置和存储介质
CN111931784A (zh) * 2020-09-17 2020-11-13 深圳壹账通智能科技有限公司 票据识别方法、系统、计算机设备与计算机可读存储介质
CN112381153A (zh) * 2020-11-17 2021-02-19 深圳壹账通智能科技有限公司 票据分类的方法、装置和计算机设备

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9824288B1 (en) * 2016-05-04 2017-11-21 Bank Of America Corporation Programmable overlay for negotiable instrument electronic image processing
CN107622255B (zh) * 2017-10-12 2020-09-01 江苏鸿信系统集成有限公司 基于位置模板与语义模板的票据图像字段定位方法及系统
CN107633239B (zh) * 2017-10-18 2020-11-03 中电鸿信信息科技有限公司 基于深度学习和ocr的票据分类及票据字段提取方法
CN109902737A (zh) * 2019-02-25 2019-06-18 厦门商集网络科技有限责任公司 一种票据分类方法及终端

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120051649A1 (en) * 2010-09-01 2012-03-01 Xerox Corporation Finding low variance regions in document images for generating image anchor templates for content anchoring, data extraction, and document classification
CN109740417A (zh) * 2018-10-29 2019-05-10 深圳壹账通智能科技有限公司 发票类型识别方法、装置、存储介质和计算机设备
CN110569850A (zh) * 2019-08-20 2019-12-13 北京旷视科技有限公司 字符识别模板匹配方法、装置和文本识别设备
CN111046736A (zh) * 2019-11-14 2020-04-21 贝壳技术有限公司 一种提取文本信息的方法、装置和存储介质
CN111931784A (zh) * 2020-09-17 2020-11-13 深圳壹账通智能科技有限公司 票据识别方法、系统、计算机设备与计算机可读存储介质
CN112381153A (zh) * 2020-11-17 2021-02-19 深圳壹账通智能科技有限公司 票据分类的方法、装置和计算机设备

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117132460A (zh) * 2023-09-12 2023-11-28 上海世禹精密设备股份有限公司 视觉检测标准图的生成方法、装置、电子设备及存储介质
CN117132460B (zh) * 2023-09-12 2024-02-27 上海世禹精密设备股份有限公司 视觉检测标准图的生成方法、装置、电子设备及存储介质
CN117315705A (zh) * 2023-10-10 2023-12-29 河北神玥软件科技股份有限公司 通用的卡证识别方法、装置、系统、电子设备及存储介质
CN117315705B (zh) * 2023-10-10 2024-04-30 河北神玥软件科技股份有限公司 通用的卡证识别方法、装置、系统、电子设备及存储介质

Also Published As

Publication number Publication date
CN112381153A (zh) 2021-02-19

Similar Documents

Publication Publication Date Title
WO2022105524A1 (zh) 票据分类的方法、装置和计算机设备
CN110390269B (zh) Pdf文档表格提取方法、装置、设备及计算机可读存储介质
WO2020232872A1 (zh) 表格识别方法、装置、计算机设备和存储介质
CN105913093B (zh) 一种用于文字识别处理的模板匹配方法
WO2020238054A1 (zh) Pdf文档中图表的定位方法、装置及计算机设备
CN108960062A (zh) 校正发票图像的方法、装置、计算机设备和存储介质
CN112070079B (zh) 基于特征图重赋权的x光违禁品包裹检测方法及装置
CN113837151B (zh) 表格图像处理方法、装置、计算机设备及可读存储介质
CN114663904A (zh) 一种pdf文档布局检测方法、装置、设备及介质
CN109583493A (zh) 一种基于深度学习的信用卡检测和数字识别方法
CN113076872B (zh) 一种智能试卷批改方法
WO2021143058A1 (zh) 基于图像的信息比对方法、装置、电子设备及计算机可读存储介质
WO2022247823A1 (zh) 图像检测方法、设备和存储介质
WO2022126917A1 (zh) 基于深度学习的人脸图像评估方法、装置、设备及介质
US20230045715A1 (en) Text detection method, text recognition method and apparatus
US20240212381A1 (en) Systems and methods for automatic detection of features on a sheet
CN112861861A (zh) 识别数码管文本的方法、装置及电子设备
CN112651315A (zh) 折线图的信息提取方法、装置、计算机设备和存储介质
CN113780116A (zh) 发票分类方法、装置、计算机设备和存储介质
CN112418206A (zh) 基于位置检测模型的图片分类方法及其相关设备
CN116012860B (zh) 一种基于图像识别的教师板书设计水平诊断方法及装置
CN111241974A (zh) 票据信息获取方法、装置、计算机设备和存储介质
CN114220103B (zh) 图像识别方法、装置、设备及计算机可读存储介质
CN113158632B (zh) Cad图纸的表格重建方法和计算机可读存储介质
CN109902724B (zh) 基于支持向量机的文字识别方法、装置和计算机设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21893672

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 19/09/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21893672

Country of ref document: EP

Kind code of ref document: A1