Bill type identification method, device and equipment and storage medium
By using feature extraction model comparative learning training, the system automatically identifies the types of financial documents, solving the problems of time-consuming and labor-intensive manual review and poor recognition accuracy in existing technologies, and achieving efficient and accurate document type identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2022-03-10
- Publication Date
- 2026-07-03
Smart Images

Figure CN116798059B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for identifying ticket types. Background Technology
[0002] In related technologies, manual review of financial documents is time-consuming and labor-intensive. If the document type is added or deleted in the classification scheme of algorithm recognition, the algorithm model needs to be retrained and the system needs to be redeployed. The matching scheme has the disadvantage of poor recognition accuracy for easily confused document types and complex document scenarios.
[0003] Therefore, it is necessary to provide a method, apparatus, device, and storage medium for identifying invoice types, which can achieve automatic identification of invoice types by accurately extracting the type characteristics of the invoice to be identified, and has high identification efficiency and accuracy, thereby reducing the cost of invoice review. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for identifying invoice types, which can achieve automatic identification of invoice types with high efficiency and accuracy, and reduce the cost of invoice review.
[0005] On the one hand, this application provides a method for identifying the type of invoice, the method comprising:
[0006] Obtain the text of the invoice to be identified and at least two candidate invoice texts of different types;
[0007] The text of the invoice to be identified is subjected to type feature extraction according to the feature extraction model to obtain the type features to be identified; the feature extraction model is obtained by comparative learning training of the pre-trained model based on the positive sample invoice text set and the negative sample invoice text set; the positive sample invoice text set corresponds to the same type feature label; the type feature labels of the negative sample invoice text set are different from those of the positive sample invoice text set.
[0008] Based on the feature extraction model, type features are extracted from the at least two candidate invoice texts of different types to obtain the candidate type features corresponding to each candidate invoice text;
[0009] Based on the comparison results between the type feature to be identified and each candidate type feature, a target candidate type feature that matches the type feature to be identified is determined.
[0010] The type corresponding to the target candidate invoice text is determined as the type of the invoice text to be identified, and the target candidate invoice text is the candidate invoice text corresponding to the target candidate type feature.
[0011] On the other hand, a ticket type identification device is provided, the device comprising:
[0012] The invoice text acquisition module is used to acquire the invoice text to be identified and at least two candidate invoice texts of different types.
[0013] The unidentified type feature extraction module is used to extract type features from the unidentified invoice text according to the feature extraction model to obtain the unidentified type features; the feature extraction model is obtained by comparative learning training of a pre-trained model based on a positive sample invoice text set and a negative sample invoice text set; the positive sample invoice text set corresponds to the same type feature label; the type feature labels of the negative sample invoice text set are different from those of the positive sample invoice text set.
[0014] The candidate type feature extraction module is used to extract type features from the at least two candidate invoice texts of different types according to the feature extraction model, so as to obtain the candidate type features corresponding to each candidate invoice text.
[0015] The target candidate type feature determination module is used to determine the target candidate type feature that matches the type feature to be identified based on the comparison results between the type feature to be identified and each candidate type feature;
[0016] The type determination module is used to determine the type corresponding to the target candidate invoice text as the type of the invoice text to be identified, wherein the target candidate invoice text is the candidate invoice text corresponding to the target candidate type feature.
[0017] On the other hand, a ticket type recognition device is provided, the device including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the ticket type recognition method as described above.
[0018] On the other hand, a computer storage medium is provided, which stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the ticket type recognition method as described above.
[0019] On the other hand, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the ticket type identification method as described above.
[0020] The document type identification method, apparatus, equipment, and storage medium provided in this application have the following technical advantages:
[0021] This application obtains the text of the invoice to be identified and at least two candidate invoice texts of different types; extracts type features from the text of the invoice to be identified according to a feature extraction model to obtain the type features to be identified; the feature extraction model is obtained by comparative learning training a pre-trained model based on a positive sample invoice text set and a negative sample invoice text set; the positive sample invoice text sets correspond to the same type feature label; the type feature labels of the negative sample invoice text sets are different from those of the positive sample invoice text sets; extracts type features from the at least two candidate invoice texts of different types according to the feature extraction model to obtain the candidate type features corresponding to each candidate invoice text; Based on the comparison results between the type feature to be identified and each candidate type feature, a target candidate type feature matching the type feature to be identified is determined; the type corresponding to the target candidate invoice text is determined as the type of the invoice text to be identified, and the target candidate invoice text is the candidate invoice text corresponding to the target candidate type feature; this application obtains a feature extraction model for invoice text based on contrastive learning training, and then extracts the type features of the invoice text to be identified and the candidate invoice text of known invoice types according to the feature extraction model, and determines the type of the invoice text to be identified based on the comparison of the type features of the two; it realizes automatic identification of invoice types, and has high identification efficiency and accuracy, reducing the cost of invoice review. Attached Figure Description
[0022] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram of a ticket type recognition system provided in an embodiment of this application;
[0024] Figure 2 This is a flowchart illustrating a method for identifying ticket types provided in an embodiment of this application;
[0025] Figure 3 This is a flowchart illustrating a training method for a feature extraction model provided in an embodiment of this application;
[0026] Figure 4 This is a flowchart illustrating a method for determining the candidate type features corresponding to each candidate document text, as provided in an embodiment of this application.
[0027] Figure 5 This is a flowchart illustrating the method for determining the candidate center features of each first candidate feature set provided in an embodiment of this application.
[0028] Figure 6 This is a flowchart illustrating the method for determining the candidate type features corresponding to each candidate document text provided in an embodiment of this application;
[0029] Figure 7 This is a flowchart illustrating the method for determining a target candidate type feature that matches the type feature to be identified, as provided in an embodiment of this application.
[0030] Figure 8 This is a flowchart illustrating another method for identifying ticket types provided in an embodiment of this application;
[0031] Figure 9 This is a schematic diagram of the structure of a ticket type recognition device provided in an embodiment of this application;
[0032] Figure 10 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation
[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0034] This application provides a method, apparatus, device, and storage medium for identifying ticket types. Specifically, the ticket type identification method of this application can be executed by a computer device, which can be a terminal or server, etc. This application can be applied to various scenarios such as data security, cloud technology, artificial intelligence, and smart transportation.
[0035] First, some of the nouns or terms that appear in the description of the embodiments of this application are explained as follows:
[0036] Intelligent transportation fully utilizes next-generation information technologies such as the Internet of Things, spatial sensing, cloud computing, and mobile internet across the entire transportation sector. It comprehensively applies theories and tools from transportation science, systems methods, artificial intelligence, and knowledge mining. With the goals of comprehensive perception, deep integration, proactive service, and scientific decision-making, it builds a real-time dynamic information service system, deeply mines transportation-related data, forms problem analysis models, and enhances the industry's ability to optimize resource allocation, improve public decision-making capabilities, enhance industry management capabilities, and improve public service capabilities. This promotes safer, more efficient, more convenient, more economical, more environmentally friendly, and more comfortable operation and development of transportation, and drives the transformation and upgrading of transportation-related industries.
[0037] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing.
[0038] Cloud technology is a collective term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.
[0039] Big data refers to data sets that cannot be captured, managed, and processed within a certain timeframe using conventional software tools. It represents massive, rapidly growing, and diverse information assets that require new processing models to achieve stronger decision-making, insightful discovery, and process optimization capabilities. With the advent of the cloud era, big data has attracted increasing attention. Big data requires specialized technologies to effectively process large amounts of data within a tolerable timeframe. Technologies suitable for big data include massively parallel processing databases, data mining, distributed file systems, distributed databases, cloud computing platforms, the internet, and scalable storage systems.
[0040] Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence.
[0041] Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning.
[0042] Deep Learning (DL) is a branch of machine learning that attempts to perform high-level abstractions of data using multiple processing layers with complex structures or multiple nonlinear transformations. Deep learning learns the inherent patterns and hierarchical representations of the features of sample objects. The information gained during this learning process greatly aids in interpreting data such as text, images, and sound. The ultimate goal of deep learning is to enable machines to possess analytical and learning capabilities similar to humans, allowing them to recognize data such as text, images, and sound. Deep learning is a complex machine learning algorithm, and its performance in speech and image recognition far surpasses previous related technologies.
[0043] Financial documents: These generally refer to documents used for financial reimbursement, including value-added tax invoices, bus tickets, train tickets, and used car transaction invoices.
[0044] OCR (Optical Character Recognition): Optical character recognition refers to the process by which electronic devices (such as scanners or digital cameras) examine characters printed on paper, determine their shapes by detecting dark and light patterns, and then translate the shapes into computer text using character recognition methods. In other words, for printed characters, optical methods are used to convert the text in paper documents into black and white dot matrix image files, and recognition software converts the text in the image into text format for further editing and processing by word processing software.
[0045] Text matching: Matching source and target texts and calculating scores to assess the relevance between them. It can also be used to match types in a knowledge base.
[0046] Contrastive learning: A self-supervised learning method that aims to learn an encoder that encodes positive examples of the same type in a similar way, while encoding negative examples of different types as differently as possible.
[0047] Representation encoder: Learns the mapping from high-dimensional observation to low-dimensional representation space, transforming an input sequence of variable length into a fixed-length context variable, thereby encoding the information of the entire input sequence. The corresponding concept is called decoder.
[0048] TF-IDF (term frequency–inverse document frequency) is a commonly used weighting technique for information retrieval and data mining. TF stands for Term Frequency, and IDF stands for Inverse Document Frequency. TF-IDF is an algorithm that combines the evaluation of TF and IDF and can be used for keyword extraction.
[0049] LDA (Latent Dirichlet Allocation): The LDA algorithm is an unsupervised machine learning model used to infer the topic distribution of documents. It can give the topic of each document in a document set in the form of a probability distribution. By analyzing some documents and extracting their topic distribution, topic clustering or topic keyword extraction can be performed based on the topic distribution.
[0050] Pre-trained models: Pre-trained models are one of the important ways to learn distributed representations in the field of natural language processing. By training with a large-scale corpus and a self-supervised learning objective, they can learn general language representations and have good generalization ability when applied to downstream tasks.
[0051] In related technologies, if a new or deleted invoice type is added, the invoice type recognition model needs to be retrained according to the invoice type recognition algorithm, which is time-consuming and affects the recognition speed of invoices. This application uses a feature extraction model to quickly extract type features and performs type recognition on the invoice to be recognized based on the type features of the newly added invoice, thereby avoiding the resources and time consumed by retraining the model and improving the recognition efficiency of the invoice to be recognized.
[0052] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0053] Please see Figure 1 , Figure 1 This is a schematic diagram of a ticket type recognition system provided in an embodiment of this application, such as... Figure 1 As shown, the ticket type recognition system may include at least server 01 and client 02.
[0054] Specifically, in this embodiment, the server 01 may include a standalone server, a distributed server, or a server cluster composed of multiple servers. It may also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server 01 may include a network communication unit, a processor, and a memory, etc. Specifically, the server 01 can be used to acquire the text of the invoice to be identified and at least two candidate invoice texts of different types; extract type features from the text of the invoice to be identified according to a feature extraction model to obtain the type features to be identified; extract type features from the at least two candidate invoice texts of different types according to the feature extraction model to obtain the candidate type features corresponding to each candidate invoice text; determine the target candidate type feature matching the type features to be identified based on the comparison results between the type features to be identified and each candidate type feature; and determine the type corresponding to the target candidate invoice text as the type of the text of the invoice to be identified.
[0055] Specifically, in this embodiment, the client 02 may include physical devices such as smartphones, desktop computers, tablets, laptops, digital assistants, smart wearable devices, smart speakers, in-vehicle terminals, and smart TVs. It may also include software running on the physical device, such as web pages provided to users by service providers, or applications provided by those service providers. Specifically, the client 02 can be used to query the type of the document text to be identified online.
[0056] The following describes a method for identifying the type of invoice according to this application. Figure 2 This is a flowchart illustrating a method for identifying ticket types according to an embodiment of this application. This specification provides the operational steps of the method described in the embodiments or flowchart, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only execution order. In actual system or server product execution, the method can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment) as shown in the embodiments or accompanying drawings. Specifically, as... Figure 2 As shown, the method may include:
[0057] S201: Obtain the text of the ticket to be identified and at least two candidate ticket texts of different types.
[0058] In this embodiment of the application, before obtaining the document text to be identified and at least two candidate document texts of different types, the method may further include:
[0059] Obtain the image of the ticket to be identified and at least two candidate ticket images of different types.
[0060] Specifically, in this embodiment, text detection can be performed on the image of the invoice to be identified to obtain the invoice text; text detection can also be performed on each candidate invoice image to obtain candidate invoice text. When performing text detection on the invoice image, Optical Character Recognition (OCR) technology can be used. The invoice image may include, but is not limited to, images captured by electronic devices, scanned documents, screenshots, etc.
[0061] S203: Extract type features from the text of the invoice to be identified according to the feature extraction model to obtain the type features to be identified; the feature extraction model is obtained by comparative learning training of the pre-trained model based on the positive sample invoice text set and the negative sample invoice text set; the positive sample invoice text set corresponds to the same type feature label; the type feature labels of the negative sample invoice text set are different from those of the positive sample invoice text set.
[0062] In this embodiment, the feature extraction model can be a representation encoder for the document text, and the type features obtained by the representation encoder can be a type vector. The type features to be identified can be used to determine the type of the document to be identified.
[0063] In this embodiment, besides the contrastive learning objective, other self-supervised learning objectives can be added. The construction method for positive ticket samples can also employ other data augmentation methods, such as input token word order scrambling, random zeroing of embedding matrix elements, and Dropout mechanisms. Dropout can be used as a parameter tuning trick for training deep neural networks. In each training batch, ignoring half of the feature detectors (making half of the hidden layer nodes 0) can significantly reduce overfitting. This method reduces the interaction between feature detectors (hidden layer nodes), where some detectors depend on others to function. During forward propagation, allowing the activation value of a neuron to stop working with a certain probability makes the model more generalizable because it doesn't rely too much on certain local features. This further improves the accuracy of the feature extraction model, makes the model more robust, and prevents overfitting.
[0064] In some embodiments, the step of extracting type features from the document text to be identified according to a feature extraction model to obtain the type features to be identified may include:
[0065] Based on the feature extraction model, type features are extracted for each document in the document text set to be identified, and the features to be identified for each document are obtained.
[0066] In this embodiment of the application, the set of invoice texts to be identified may include at least two invoice texts to be identified. These two invoice texts may be two texts corresponding to one invoice image to be identified. For example, the invoice image to be identified may be parsed into multiple invoice texts to be identified. Alternatively, multiple invoice texts corresponding to the same invoice image to be identified may be detected.
[0067] Clustering algorithms are used to cluster the various invoice texts in the invoice text set to be identified, thereby determining the central features to be identified in the invoice text set.
[0068] In the embodiments of this application, the clustering algorithm may include, but is not limited to, K-Means clustering algorithm, mean-shift clustering algorithm, density-based clustering method (DBSCAN), expectation-maximum (EM) clustering algorithm using Gaussian mixture model (GMM), agglomerative hierarchical clustering, graph community detection algorithm, etc.
[0069] The central feature to be identified is used as the type feature to be identified.
[0070] In the embodiments of this application, the central feature to be identified can more accurately characterize the text set of the invoice to be identified, thereby improving the accuracy of determining the type of the text set of the invoice to be identified.
[0071] In some embodiments, the step of extracting type features from the document text to be identified according to a feature extraction model to obtain the type features to be identified may include:
[0072] The text of the invoice to be identified is input into the feature extraction model for type feature extraction to obtain the first feature to be identified.
[0073] Determine the target data to be identified corresponding to the invoice text to be identified, wherein the target data to be identified includes at least one of the title and keywords corresponding to the invoice text to be identified;
[0074] In this embodiment of the application, the target data to be identified can be manually constructed according to the text of the invoice to be identified, or the target data to be identified according to the text of the invoice to be identified can be extracted based on keyword extraction algorithms such as TF-IDF and LDA topic model; the target data to be identified can be one or more keywords.
[0075] In this application embodiment, for train tickets, the corresponding keywords may include: second-class seat, hard seat, etc.; for bus tickets, the corresponding keywords may include: passenger transport, bus, etc.
[0076] The target data to be identified is input into a feature extraction model to extract type features, thereby obtaining a second feature to be identified.
[0077] In this embodiment of the application, if there are multiple target data to be identified, the set of target data to be identified is input into the feature extraction model for type feature extraction to obtain the second feature to be identified.
[0078] In this embodiment of the application, if there are multiple invoice texts to be identified, and each invoice text corresponds to a target dataset to be identified, then each target dataset to be identified can be input into the feature extraction model to obtain the second feature to be identified corresponding to each target dataset to be identified, thus forming a second feature set to be identified; then, the clustering algorithm is used to determine the center feature to be identified of the second feature set to be identified; the obtained center feature to be identified can more accurately characterize the type of the second feature set to be identified, thereby improving the accuracy of invoice type identification of the invoices to be identified.
[0079] The type feature to be identified is determined based on the first feature to be identified and the second feature to be identified.
[0080] In this embodiment of the application, determining the type feature to be identified based on the first feature to be identified and the second feature to be identified may include:
[0081] The type feature to be identified is determined based on the center feature to be identified and the second feature to be identified.
[0082] In this embodiment of the application, determining the type feature to be identified based on the first feature to be identified and the second feature to be identified may include:
[0083] The type feature to be identified is determined based on the central feature to be identified corresponding to the first feature set to be identified and the central feature to be identified corresponding to the second feature set to be identified.
[0084] In this embodiment, the two types of center features to be identified can be weighted and averaged to obtain the type features to be identified; the type features to be identified are determined by the determined center features to be identified, thereby improving the representation accuracy of the type features to be identified and improving the recognition accuracy of the document text to be identified.
[0085] In some embodiments, after determining the central feature to be identified, outliers in the feature set can be determined based on the feature, and then the outliers can be removed from the feature set to obtain an updated feature set, thereby determining the updated central feature to be identified again. Based on the updated central feature to be identified, more accurate features of the type to be identified can be obtained.
[0086] In some embodiments, the method further includes:
[0087] Based on the identification center features of the text set of invoices to be identified, the outliers of the text set of invoices to be identified are determined;
[0088] In this embodiment, outliers may include erroneous document text identified through a blurred document image and document text that deviates significantly from the central features to be identified. These texts can cause significant errors and therefore need to be removed from the text set to improve the accuracy of updated features for the identified type.
[0089] The outliers are removed from the set of invoice texts to be identified, resulting in an updated set of invoice texts to be identified.
[0090] Determine the updated central features of the updated set of invoice texts to be identified.
[0091] In some embodiments, the target center features of the target dataset to be identified can also be updated according to a similar method.
[0092] In some embodiments, determining the type feature to be identified based on the center feature to be identified and the second feature to be identified may include:
[0093] The type feature to be identified is determined based on the updated center feature to be identified and the second feature to be identified.
[0094] In the embodiments of this application, such as Figure 3 As shown, the training method for the feature extraction model includes:
[0095] S301: Obtain a sample document text set, which includes the positive sample document text set and the negative sample document text set; each sample document text in the sample document text set is labeled with a type feature tag;
[0096] S303: Based on the positive sample ticket text set and the negative sample ticket text set, perform comparative learning training on the pre-trained model to extract type features; so as to adjust the model parameters of the pre-trained model until the type feature label of each sample ticket text output by the pre-trained model matches the labeled type feature label;
[0097] In this embodiment of the application, through comparative learning training, the features between positive sample document texts in the positive sample document text set are made more similar, the features between negative sample document texts in the negative sample document text set are made more similar, and the feature difference between positive sample document texts and negative sample document texts is made larger; thereby ensuring that the accuracy of the trained feature extraction model is higher.
[0098] In the embodiments of this application, the pre-trained model may include, but is not limited to, BERT, RoBERTa, AlBERT, etc. BERT stands for Bidirectional Encoder Representation from Transformers, and it is a pre-trained language representation model. It emphasizes that instead of using traditional unidirectional language models or shallow concatenation of two unidirectional language models for pre-training, it employs a new masked language model (MLM) to generate deep bidirectional language representations. RoBERTa (a Robustly Optimized BERT Pretraining Approach) mainly makes several adjustments to BERT: 1) longer training time, larger batch size, and more training data; 2) removal of the NSP (Next Sentence Predict) task; 3) longer training sequences; 4) dynamic masking mechanism. Compared to BERT, AlBERT (A Lite BERT For Self-Supervised Learning Of Language Representations) increases the hidden size, i.e., the number of features in each embedding layer.
[0099] In this embodiment of the application, the objective function of the model can be:
[0100]
[0101] Here, sim refers to the similarity function, typically using cosine similarity; hi+ represents positive examples of samples hi; hj- represents negative examples of samples hj; and the parameter τ is a temperature hyperparameter used to control the impact of the difficulty of negative examples, focusing model updates on challenging negative examples. The value of the τ hyperparameter needs to find a balance between encouraging uniformity and tolerating potential misclassification of positive examples as negative examples. The learning objective of this objective function is to enable the representation encoder to encode positive examples that are relatively close and negative examples that are relatively far apart.
[0102] S305: The pre-trained model corresponding to the model parameters when the type feature labels of each output sample ticket text are matched with the labeled type feature labels is used as the feature extraction model.
[0103] In this embodiment of the application, the trained feature extraction model is a representation encoder that can be used to convert invoice text into a vector representing type features.
[0104] S205: Extract type features from the at least two candidate invoice texts of different types according to the feature extraction model to obtain the candidate type features corresponding to each candidate invoice text.
[0105] In the embodiments of this application, such as Figure 4 As shown, the step of extracting type features from the at least two candidate invoice texts of different types according to the feature extraction model to obtain candidate type features corresponding to each candidate invoice text includes:
[0106] S2051: Input the at least two different types of candidate invoice texts into the feature extraction model to obtain the first candidate feature corresponding to each candidate invoice text;
[0107] In this embodiment, the candidate ticket text is text of a known ticket type, which may include, but is not limited to, train tickets, bus tickets, restaurant invoices, and accommodation invoices. Various types of candidate ticket text can be pre-acquired, with one candidate ticket text corresponding to each type; then, a feature extraction model is used to extract the first candidate feature corresponding to each candidate ticket text.
[0108] In the embodiments of this application, such as Figure 5 As shown, there are at least two candidate invoice texts of each type. The step of inputting the at least two candidate invoice texts of different types into the feature extraction model to obtain the first candidate feature corresponding to each candidate invoice text includes:
[0109] S205101: Construct a candidate bill text set based on at least two candidate bill texts of the same type;
[0110] In some embodiments, multiple candidate invoice texts of the same type can be obtained to obtain multiple types of candidate invoice text sets, with each candidate invoice text set corresponding to the same type; thus, various candidate type features can be determined based on each candidate invoice text set.
[0111] S205103: Input each candidate invoice text set into the feature extraction model to obtain the first candidate feature set corresponding to each candidate invoice text set;
[0112] In this embodiment, each candidate document text in the candidate document text set can be input into a feature extraction model to obtain candidate features for each candidate document text, thereby constructing a first candidate feature set corresponding to the candidate document text set.
[0113] S205105: Based on the clustering algorithm, determine the candidate center features of each first candidate feature set.
[0114] In this embodiment, the candidate center features of each first candidate feature set can be directly used as the candidate type features of each first candidate feature set; alternatively, the candidate type features of each first candidate feature set can be further determined based on the candidate center features. Clustering algorithms may include, but are not limited to, K-Means clustering, mean-shift clustering, density-based clustering (DBSCAN), expectation-maximization (EM) clustering using Gaussian mixture models (GMM), agglomerative hierarchical clustering, and graph community detection algorithms.
[0115] In some embodiments, outliers of each first candidate feature set can be determined based on the candidate center features of each first candidate feature set, thereby performing feature filtering and improving the accuracy of candidate type features.
[0116] In this embodiment of the application, after determining the candidate center features of each first candidate feature set according to the clustering algorithm, the method further includes:
[0117] Based on the candidate center features of each first candidate feature set, outliers in each first candidate feature set are selected.
[0118] In this embodiment of the application, outliers in the first candidate feature set are features that are far from the candidate center features of the first candidate feature set.
[0119] Remove the outliers corresponding to each first candidate feature set from each first candidate feature set to obtain the first updated candidate feature set for each first candidate feature set;
[0120] Determine the update candidate center features corresponding to each first update candidate feature set.
[0121] In this embodiment of the application, by deleting outliers in the first candidate feature set, the accuracy of updating candidate center features can be improved, thereby improving the accuracy of identifying the document type of the document text to be identified.
[0122] In some embodiments, candidate center features of the second candidate feature set can also be determined and updated using a similar method.
[0123] S2053: Determine the candidate target data corresponding to each candidate invoice text; the candidate target data includes at least one of the title and keywords corresponding to the candidate invoice text;
[0124] In this embodiment of the application, each candidate ticket text may correspond to one or more candidate target data.
[0125] S2055: Input each candidate target data into the feature extraction model to obtain the second candidate feature corresponding to each candidate invoice text;
[0126] In this embodiment of the application, the title feature vector or keyword feature vector corresponding to each candidate ticket text can be obtained through a feature extraction model.
[0127] S2057: Determine the candidate type feature corresponding to each candidate invoice text based on the first candidate feature and the second candidate feature corresponding to each candidate invoice text.
[0128] In the embodiments of this application, such as Figure 6 As shown, the step of determining the candidate type feature corresponding to each candidate invoice text based on the first candidate feature and the second candidate feature corresponding to each candidate invoice text includes:
[0129] S20571: Determine the first weight of the first candidate feature and the second weight of the second candidate feature;
[0130] In this embodiment of the application, the values of the first weight and the second weight can be set according to the actual situation.
[0131] S20573: Calculate the product of each first candidate feature and the first weight to obtain the first type of feature;
[0132] S20575: Calculate the product of each second candidate feature and the second weight to obtain the second type of feature;
[0133] S20577: Take the average of the first type feature and the second type feature corresponding to each candidate invoice text as the candidate type feature corresponding to each candidate invoice text.
[0134] In this embodiment of the application, the weighted average of the first candidate feature and the second candidate feature corresponding to each candidate document text can be used as the candidate type feature corresponding to each candidate document text, thereby improving the accuracy of the candidate type feature.
[0135] In this embodiment of the application, after determining the candidate center features corresponding to each candidate invoice text set, the step of determining the candidate type features corresponding to each candidate invoice text based on the first candidate features and the second candidate features corresponding to each candidate invoice text includes:
[0136] Based on the candidate center features and second candidate features corresponding to each candidate invoice text set, the candidate type features corresponding to each candidate invoice text set are determined.
[0137] In this embodiment of the application, after determining the updated candidate center feature corresponding to each candidate document text set, the step of determining the candidate type feature corresponding to each candidate document text set based on the candidate center feature and the second candidate feature includes:
[0138] Based on the updated candidate center features and second candidate features corresponding to each candidate document text set, the candidate type features corresponding to each candidate document text set are determined.
[0139] S207: Based on the comparison results between the type feature to be identified and each candidate type feature, determine the target candidate type feature that matches the type feature to be identified.
[0140] In the embodiments of this application, the target candidate type feature can be determined by calculating the similarity or distance between the type feature to be identified and each candidate type feature.
[0141] In the embodiments of this application, such as Figure 7 As shown, determining the target candidate type feature that matches the type feature to be identified based on the comparison results between the type feature to be identified and each candidate type feature includes:
[0142] S2071: Calculate the similarity between the type feature to be identified and each candidate type feature to obtain the similarity result corresponding to each candidate type feature;
[0143] In the embodiments of this application, the cosine similarity between the type feature to be identified and each candidate type feature can be calculated to obtain the similarity result corresponding to each candidate type feature.
[0144] S2073: Sort the candidate type features according to the similarity results corresponding to each candidate type feature;
[0145] In the embodiments of this application, the candidate type features can be sorted from largest to smallest or smallest to largest according to the similarity results.
[0146] S2075: Based on the sorting results, determine the target candidate type features that match the type features to be identified.
[0147] In this embodiment of the application, the candidate type feature with the highest similarity can be used as the target candidate type feature.
[0148] In this embodiment of the application, candidate invoice images can be obtained through big data, thereby further determining the candidate invoice text, obtaining the candidate type, and calculating the similarity between the features of the type to be identified and the features of the candidate type.
[0149] S209: The type corresponding to the target candidate invoice text is determined as the type of the invoice text to be identified, and the target candidate invoice text is the candidate invoice text corresponding to the target candidate type feature.
[0150] In this embodiment of the application, after determining the target candidate type feature, the candidate invoice text corresponding to the target candidate type feature can be determined. Since the candidate invoice text is of a known type, the type corresponding to the candidate invoice text can be determined as the type of the invoice text to be identified.
[0151] In a specific embodiment, such as Figure 8 As shown, Figure 8 A flowchart illustrating a method for identifying ticket types, including:
[0152] S801: A ticket matching model is obtained based on contrastive learning training;
[0153] S803: Generate the vector center for each type of bill based on the bill sample;
[0154] S805: Construct a set of type keywords using methods such as manual construction, TF-IDF, or LDA;
[0155] S807: Based on the removal of outliers and the fine-tuning of keyword vectors, the optimized invoice vector center is obtained, and the invoice type vector is determined;
[0156] S809: Obtain the image of the invoice to be recognized;
[0157] S8011: Recognize OCR text based on the image of the invoice to be recognized;
[0158] S8013: Generate the text vector of the invoice to be recognized based on the OCR text;
[0159] S8015: Match the text vector of the invoice to be identified with multiple invoice type vectors to predict the invoice type of the invoice image to be identified.
[0160] This embodiment can automatically identify the type of financial invoices based on images, achieving high accuracy even for easily confused invoice types and complex invoice scenarios (such as diverse invoice styles and text). Furthermore, because the matching scheme is deployed online, adding or deleting invoice types does not require retraining and re-deployment. By employing contrastive learning training and optimizing the matching effect through outlier removal and type keyword integration for the type vector center, it often achieves better matching results compared to traditional interaction- or representation-based matching schemes. This provides efficient and convenient services for financial invoice review and information extraction scenarios, effectively reducing manual review costs, improving review efficiency, and realizing intelligent financial office operations. If an invoice type is added or deleted, the invoice type recognition model needs to be retrained according to the relevant invoice type recognition algorithm, which is time-consuming and affects the invoice recognition speed. This application uses a feature extraction model to quickly extract type features and performs type recognition on the invoice to be identified based on the type features of the newly added invoice, thereby avoiding the resource consumption of model retraining and improving the recognition efficiency of the invoice to be identified.
[0161] As can be seen from the technical solutions provided by the embodiments of this application above, the embodiments of this application obtain the text of the invoice to be identified and at least two candidate invoice texts of different types; extract type features from the text of the invoice to be identified according to the feature extraction model to obtain the type features to be identified; the feature extraction model is obtained by comparative learning training of a pre-trained model based on a positive sample invoice text set and a negative sample invoice text set; the positive sample invoice text set corresponds to the same type feature label; the type feature labels of the negative sample invoice text set are different from those of the positive sample invoice text set; extract type features from the at least two candidate invoice texts of different types according to the feature extraction model to obtain the type features of each candidate invoice text. The application obtains a feature extraction model for invoice text based on contrastive learning training, and then extracts type features for both the invoice text to be identified and candidate invoice texts of known invoice types based on the feature extraction model. The type of the invoice text to be identified is determined by comparing the type features of the two models. This achieves automatic identification of invoice types with high efficiency and accuracy, reducing the cost of manual invoice review.
[0162] This application also provides a document type identification device, such as... Figure 9 As shown, the device includes:
[0163] The invoice text acquisition module 910 is used to acquire the invoice text to be identified and at least two candidate invoice texts of different types;
[0164] The feature extraction module 920 for identifying the type is used to extract type features from the text of the invoice to be identified according to the feature extraction model, thereby obtaining the type features to be identified. The feature extraction model is obtained by comparative learning training of a pre-trained model based on a positive sample invoice text set and a negative sample invoice text set. The positive sample invoice text set corresponds to the same type feature label. The type feature labels of the negative sample invoice text set are different from those of the positive sample invoice text set.
[0165] The candidate type feature extraction module 930 is used to extract type features from the at least two candidate invoice texts of different types according to the feature extraction model, so as to obtain the candidate type features corresponding to each candidate invoice text.
[0166] The target candidate type feature determination module 940 is used to determine the target candidate type feature that matches the type feature to be identified based on the comparison results between the type feature to be identified and each candidate type feature;
[0167] The type determination module 950 is used to determine the type corresponding to the target candidate invoice text as the type of the invoice text to be identified, wherein the target candidate invoice text is the candidate invoice text corresponding to the target candidate type feature.
[0168] In some embodiments, the candidate type feature extraction module may include:
[0169] The first candidate feature determination submodule is used to input the at least two different types of candidate invoice texts into the feature extraction model to obtain the first candidate feature corresponding to each candidate invoice text.
[0170] The candidate target data determination submodule is used to determine the candidate target data corresponding to each candidate invoice text; the candidate target data includes at least one of the title and keywords corresponding to the candidate invoice text.
[0171] The second candidate feature determination submodule is used to input each candidate target data into the feature extraction model to obtain the second candidate feature corresponding to each candidate invoice text.
[0172] The candidate type feature determination submodule is used to determine the candidate type feature corresponding to each candidate invoice text based on the first candidate feature and the second candidate feature corresponding to each candidate invoice text.
[0173] In some embodiments, the candidate type feature determination submodule may include:
[0174] A weight determination unit is used to determine a first weight of the first candidate feature and a second weight of the second candidate feature;
[0175] The first type feature determination unit is used to calculate the product of each first candidate feature and the first weight to obtain the first type feature;
[0176] The second type feature determination unit is used to calculate the product of each second candidate feature and the second weight to obtain the second type feature;
[0177] The candidate type feature determination unit is used to take the average of the first type feature and the second type feature corresponding to each candidate document text as the candidate type feature corresponding to each candidate document text.
[0178] In some embodiments, there are at least two candidate document texts of each type, and the first candidate feature determination submodule may include:
[0179] The candidate invoice text set construction unit is used to construct a candidate invoice text set based on at least two candidate invoice texts of the same type.
[0180] The first candidate feature set determination unit is used to input each candidate invoice text set into the feature extraction model to obtain the first candidate feature set corresponding to each candidate invoice text set.
[0181] The candidate center feature determination unit is used to determine the candidate center features of each first candidate feature set according to the clustering algorithm.
[0182] In some embodiments, the candidate type feature determination submodule includes:
[0183] The candidate type feature determination unit is used to determine the candidate type feature corresponding to each candidate document text set based on the candidate center feature and the second candidate feature corresponding to each candidate document text set.
[0184] In some embodiments, the candidate center feature determination unit may include:
[0185] The outlier filtering subunit is used to filter out outliers in each first candidate feature set based on the candidate center features of each first candidate feature set.
[0186] The first updated candidate feature set determination subunit is used to delete outliers corresponding to each first candidate feature set from each first candidate feature set to obtain the first updated candidate feature set of each first candidate feature set.
[0187] The updated candidate center feature determination subunit is used to determine the updated candidate center features corresponding to each first updated candidate feature set;
[0188] In some embodiments, the candidate type feature determination unit may include:
[0189] The candidate type feature determination subunit is used to determine the candidate type feature corresponding to each candidate document text set based on the updated candidate center feature and the second candidate feature corresponding to each candidate document text set.
[0190] In some embodiments, the apparatus may further include:
[0191] The sample document text set acquisition module is used to acquire a sample document text set, which includes the positive sample document text set and the negative sample document text set; each sample document text in the sample document text set is labeled with a type feature tag;
[0192] The training module is used to perform comparative learning training on the pre-trained model based on the positive sample ticket text set and the negative sample ticket text set; in order to adjust the model parameters of the pre-trained model so that the type feature label of each sample ticket text output by the pre-trained model matches the labeled type feature label.
[0193] The feature extraction model determination module is used to determine the pre-trained model corresponding to the model parameters when the type feature labels of each output sample document text are matched with the labeled type feature labels, and use this model as the feature extraction model.
[0194] In some embodiments, the target candidate type feature determination module may include:
[0195] The similarity calculation submodule is used to calculate the similarity between the feature to be identified and each candidate feature, and to obtain the similarity result corresponding to each candidate feature;
[0196] The sorting submodule is used to sort the candidate type features according to the similarity results corresponding to each candidate type feature;
[0197] The target candidate type feature determination submodule is used to determine the target candidate type features that match the type features to be identified based on the sorting results.
[0198] The apparatus and method embodiments described herein are based on the same inventive concept.
[0199] This application provides a bill type recognition device, which includes a processor and a memory. The memory stores at least one instruction or at least one program, which is loaded and executed by the processor to implement the bill type recognition method provided in the above method embodiments.
[0200] Embodiments of this application also provide a computer storage medium, which can be disposed in a terminal to store at least one instruction or at least one program related to implementing a ticket type recognition method in the method embodiment. The at least one instruction or at least one program is loaded and executed by the processor to implement the ticket type recognition method provided in the above method embodiment.
[0201] Embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the ticket type identification method provided in the above-described method embodiments.
[0202] Optionally, in this embodiment, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0203] The memory described in this application embodiment can be used to store software programs and modules. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for the functions, etc.; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide the processor with access to the memory.
[0204] The document type identification method embodiments provided in this application can be executed on mobile terminals, computer terminals, servers, or similar computing devices. Taking running on a server as an example, Figure 10 This is a hardware structure block diagram of a server for a ticket type recognition method provided in an embodiment of this application. For example... Figure 10 As shown, the server 1000 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1010 (CPUs 1010 may include, but are not limited to, microprocessors (MCUs) or programmable logic devices (FPGAs), a memory 1030 for storing data, and one or more storage media 1020 (e.g., one or more mass storage devices) for storing application programs 1023 or data 1022. The memory 1030 and storage media 1020 may be temporary or persistent storage. The program stored in the storage media 1020 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 1010 may be configured to communicate with the storage media 1020 and execute the series of instruction operations in the storage media 1020 on the server 1000. Server 1000 may also include one or more power supplies 1060, one or more wired or wireless network interfaces 1050, one or more input / output interfaces 1040, and / or one or more operating systems 1021, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0205] The input / output interface 1040 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 1000. In one example, the input / output interface 1040 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 1040 may be a radio frequency (RF) module for wireless communication with the Internet.
[0206] Those skilled in the art will understand that Figure 10 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 1000 may also include... Figure 10 The more or fewer components shown, or having the same Figure 10 The different configurations shown.
[0207] As can be seen from the embodiments of the invoice type recognition method, apparatus, device, or storage medium provided in this application, this application acquires the invoice text to be recognized and at least two candidate invoice texts of different types; extracts type features from the invoice text to be recognized according to a feature extraction model to obtain the type features to be recognized; the feature extraction model is obtained by comparative learning training a pre-trained model based on a positive sample invoice text set and a negative sample invoice text set; the positive sample invoice text set corresponds to the same type feature label; the type feature labels of the negative sample invoice text set are different from those of the positive sample invoice text set; and the type features are extracted from the at least two candidate invoice texts of different types according to the feature extraction model to obtain each type feature. Candidate type features corresponding to candidate invoice texts; based on the comparison results between the type feature to be identified and each candidate type feature, a target candidate type feature matching the type feature to be identified is determined; the type corresponding to the target candidate invoice text is determined as the type of the invoice text to be identified, and the target candidate invoice text is the candidate invoice text corresponding to the target candidate type feature; this application obtains a feature extraction model for invoice text based on contrastive learning training, and then extracts type features of the invoice text to be identified and candidate invoice texts of known invoice types according to the feature extraction model, and determines the type of the invoice text to be identified based on the comparison of the type features of the two; it realizes automatic identification of invoice types, and has high identification efficiency and accuracy, reducing the cost of manual review of invoices.
[0208] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, specific embodiments have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0209] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0210] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer storage medium, such as a read-only memory, a disk, or an optical disk.
[0211] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for identifying ticket types, characterized in that, The method includes: The process involves acquiring an image of a ticket to be identified and at least two candidate ticket images of different types, parsing the image of the ticket to be identified into multiple texts of the ticket to be identified to obtain a set of texts of the ticket to be identified, and performing text detection on each candidate ticket image to obtain at least two candidate ticket texts of different types. The feature extraction model extracts type features from each of the texts in the text set of invoices to be identified, obtaining the type features to be identified for each text. A clustering algorithm is then used to cluster the texts in the text set to be identified, determining the center features to be identified for each text set. These center features are then used as the type features to be identified for the invoice image. The feature extraction model is trained by comparative learning on a pre-trained model based on positive and negative sample text sets. Positive sample texts in the positive sample text set correspond to the same type feature label; the type feature labels of negative sample texts in the negative sample text set differ from those of the positive sample text set. Multiple candidate invoice texts of the same type are obtained to form multiple sets of candidate invoice texts of different types; the candidate invoice texts in each set of candidate invoice texts correspond to the same type. Each candidate invoice text set is input into the feature extraction model to obtain the first candidate feature set corresponding to each candidate invoice text set; Based on the clustering algorithm, the candidate center features of each first candidate feature set are determined; Based on the candidate center features of each first candidate feature set, outliers in each first candidate feature set are selected; outliers corresponding to each first candidate feature set are deleted from each first candidate feature set to obtain the first updated candidate feature set for each first candidate feature set. Determine the update candidate center features corresponding to each first update candidate feature set; Determine the candidate target data corresponding to each candidate invoice text; the candidate target data includes at least one of the title and keywords corresponding to the candidate invoice text. Each candidate target data is input into the feature extraction model to obtain the second candidate feature corresponding to each candidate invoice text; Based on the updated candidate center feature and the second candidate feature corresponding to each candidate document text set, the candidate type feature corresponding to each candidate document text set is obtained; Based on the comparison results between the type feature to be identified and each candidate type feature, a target candidate type feature that matches the type feature to be identified is determined. The type corresponding to the target candidate invoice text is determined as the type of the invoice text to be identified, and the target candidate invoice text is the candidate invoice text corresponding to the target candidate type feature.
2. The method according to claim 1, characterized in that, The step of determining the candidate type feature corresponding to each candidate invoice text based on the first candidate feature and the second candidate feature corresponding to each candidate invoice text includes: Determine the first weight of the first candidate feature and the second weight of the second candidate feature; Calculate the product of each first candidate feature and the first weight to obtain the first type of feature; Calculate the product of each second candidate feature and the second weight to obtain the second type of feature; The average of the first type feature and the second type feature corresponding to each candidate invoice text is used as the candidate type feature corresponding to each candidate invoice text.
3. The method according to any one of claims 1-2, characterized in that, The training method for the feature extraction model includes: Obtain a sample document text set, which includes the positive sample document text set and the negative sample document text set; each sample document text in the sample document text set is labeled with a type feature tag; Based on the positive sample ticket text set and the negative sample ticket text set, the pre-trained model is subjected to comparative learning training for type feature extraction; in order to adjust the model parameters of the pre-trained model so that the type feature label of each sample ticket text output by the pre-trained model matches the labeled type feature label. The pre-trained model corresponding to the model parameters when the type feature labels of each output sample ticket text are matched with the labeled type feature labels is used as the feature extraction model.
4. The method according to any one of claims 1-2, characterized in that, The step of determining the target candidate type feature that matches the type feature to be identified based on the comparison results between the type feature to be identified and each candidate type feature includes: Calculate the similarity between the feature to be identified and each candidate type feature to obtain the similarity result corresponding to each candidate type feature; Based on the similarity results corresponding to each candidate type feature, the candidate type features are sorted. Based on the sorting results, target candidate type features that match the type features to be identified are determined.
5. A ticket type identification device, characterized in that, The device includes: The invoice text acquisition module is used to acquire an image of an invoice to be identified and at least two candidate invoice images of different types, parse the image of the invoice to be identified into multiple invoice texts to be identified, and obtain a set of invoice texts to be identified; and perform text detection on each candidate invoice image to obtain at least two candidate invoice texts of different types. The module for extracting the type feature of the to-be-identified invoice text set is used to extract type features for each to-be-identified invoice text in the to-be-identified invoice text set according to the feature extraction model, thereby obtaining the to-be-identified type feature of each to-be-identified invoice text text; to perform clustering processing on each to-be-identified invoice text set according to the clustering algorithm, thereby determining the to-be-identified center feature of the to-be-identified invoice text set; and to use the to-be-identified center feature as the to-be-identified type feature of the to-be-identified invoice image; the feature extraction model is obtained by comparative learning training of a pre-trained model based on positive sample invoice text sets and negative sample invoice text sets; positive sample invoice text sets correspond to the same type feature label; and the type feature labels of negative sample invoice text sets are different from those of positive sample invoice text sets. The candidate type feature extraction module is used to extract type features from the at least two candidate invoice texts of different types according to the feature extraction model, so as to obtain the candidate type features corresponding to each candidate invoice text. The target candidate type feature determination module is used to determine the target candidate type feature that matches the type feature to be identified based on the comparison results between the type feature to be identified and each candidate type feature; The type determination module is used to determine the type corresponding to the target candidate invoice text as the type of the invoice text to be identified, wherein the target candidate invoice text is the candidate invoice text corresponding to the target candidate type feature; The candidate type feature extraction module includes: The first candidate feature determination submodule is used to input the at least two candidate invoice texts of different types into the feature extraction model to obtain the first candidate feature corresponding to each candidate invoice text; the first candidate feature determination submodule includes: a candidate invoice text set construction unit, used to obtain multiple candidate invoice texts of the same type to obtain multiple types of candidate invoice text sets; the candidate invoice texts in each candidate invoice text set correspond to the same type; a first candidate feature set determination unit, used to input each candidate invoice text set into the feature extraction model to obtain the first candidate feature set corresponding to each candidate invoice text set; a candidate center feature determination unit, used to determine the candidate center feature of each first candidate feature set according to the clustering algorithm; the candidate center feature determination unit includes: an outlier filtering subunit, used to filter out outliers in each first candidate feature set according to the candidate center feature of each first candidate feature set; The first updated candidate feature set determination subunit is used to delete outliers corresponding to each first candidate feature set from each first candidate feature set to obtain a first updated candidate feature set for each first candidate feature set; the updated candidate center feature determination subunit is used to determine the updated candidate center feature corresponding to each first updated candidate feature set; the candidate target data determination submodule is used to determine the candidate target data corresponding to each candidate invoice text; the candidate target data includes at least one of the title and keywords corresponding to the candidate invoice text; The second candidate feature determination submodule is used to input each candidate target data into the feature extraction model to obtain the second candidate feature corresponding to each candidate invoice text. The candidate type feature determination submodule is used to determine the candidate type feature corresponding to each candidate document text set based on the updated candidate center feature and the second candidate feature corresponding to each candidate document text set.
6. The apparatus according to claim 5, characterized in that, The candidate type feature determination submodule includes: A weight determination unit is used to determine a first weight of the first candidate feature and a second weight of the second candidate feature; The first type feature determination unit is used to calculate the product of each first candidate feature and the first weight to obtain the first type feature; The second type feature determination unit is used to calculate the product of each second candidate feature and the second weight to obtain the second type feature; The candidate type feature determination unit is used to take the average of the first type feature and the second type feature corresponding to each candidate document text as the candidate type feature corresponding to each candidate document text.
7. The apparatus according to any one of claims 5-6, characterized in that, The device further includes: The sample document text set acquisition module is used to acquire a sample document text set, which includes the positive sample document text set and the negative sample document text set; each sample document text in the sample document text set is labeled with a type feature tag; The training module is used to perform comparative learning training on the pre-trained model based on the positive sample ticket text set and the negative sample ticket text set; in order to adjust the model parameters of the pre-trained model so that the type feature label of each sample ticket text output by the pre-trained model matches the labeled type feature label. The feature extraction model determination module is used to determine the pre-trained model corresponding to the model parameters when the type feature labels of each output sample document text are matched with the labeled type feature labels, and use this model as the feature extraction model.
8. The apparatus according to any one of claims 5-6, characterized in that, The target candidate type feature determination module includes: The similarity calculation submodule is used to calculate the similarity between the feature to be identified and each candidate feature, and to obtain the similarity result corresponding to each candidate feature; The sorting submodule is used to sort the candidate type features according to the similarity results corresponding to each candidate type feature; The target candidate type feature determination submodule is used to determine the target candidate type features that match the type features to be identified based on the sorting results.
9. A ticket type recognition device, characterized in that, The device includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the ticket type recognition method as described in any one of claims 1-4.
10. A computer storage medium, characterized in that, The computer storage medium stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the ticket type recognition method as described in any one of claims 1-4.
11. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the ticket type recognition method as described in any one of claims 1-4.