Table data recognition method, system, medium and device based on deep learning

By introducing the Transformer architecture, self-attention network, and joint loss function into table processing, the problems of target bias and structural information degradation in existing technologies are solved, achieving high-precision classification of table text fields, which is suitable for scenarios such as financial statements and bills.

CN122489773APending Publication Date: 2026-07-31SHANDONG CITY COMMERCIAL BANK COOP ALLIANCE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANDONG CITY COMMERCIAL BANK COOP ALLIANCE CO LTD
Filing Date
2026-07-01
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing technologies for table processing suffer from problems such as discrepancies between pre-training and classification task objectives, difficulty in widening inter-class distances due to cross-entropy loss, and easy degradation of table structure information, resulting in insufficient classification accuracy for table text fields.

Method used

We employ an encoder based on the Transformer architecture, combining a self-attention network and a feedforward network. Through joint optimization of mask cross-entropy loss and classification loss, we construct a hierarchical feature extraction architecture, introduce positional encoding and sample similarity constraints, and achieve end-to-end joint optimization.

Benefits of technology

It significantly improves the classification accuracy of text fields in tables, enhances the ability to distinguish semantically similar fields, maintains the integrity of table structure information, and simplifies the training process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122489773A_ABST
    Figure CN122489773A_ABST
Patent Text Reader

Abstract

This invention discloses a method, system, medium, and device for recognizing tabular data based on deep learning, belonging to the field of natural language processing and structured data recognition technology. The method includes: standardizing tabular data to obtain standardized text; segmenting it into sub-word units and generating embedding vectors and positional codes determined by row and column numbers; inputting the embedding representations into the encoder to output context feature vectors, randomly masking by row or column and pre-training using masked cross-entropy loss; aggregating the sub-word feature vectors of the same cell to obtain cell feature vectors, outputting classification probabilities through a classification task layer; constructing a weighted sum of cross-entropy loss and center loss as the classification loss, and combining it with the masked cross-entropy loss to form a total loss function, jointly optimizing the network parameters. This invention solves the problems of deviation between pre-training and classification task objectives, difficulty in widening inter-class distances, and easy degradation of tabular structural information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing and structured data recognition technology, specifically relating to a method, system, medium, and device for recognizing tabular data based on deep learning. Background Technology

[0002] Tables, as the core carrier of structured data, are widely used in scenarios such as financial statements, business ledgers, and invoices. Extracting and classifying contextual features from text fields within tables is a crucial step in applications such as sensitive data identification and information extraction. With the development of deep learning technology, table processing methods based on the Transformer architecture have gradually become mainstream.

[0003] Existing technologies, such as CN121435989B, disclose a method for large-scale table question answering using dual-axis positional encoding and a joint task loss function. This method constructs and fuses row and column positional encodings to obtain dual-axis positional encoding, thereby capturing the row and column structure information of the table. The table content is embedded and combined with the dual-axis positional encoding before being input into the encoder for table representation learning. During the training process, a joint task loss function is designed to enhance the model's ability to understand the semantic and structural information of the table.

[0004] However, the aforementioned existing technologies still have the following shortcomings: First, the pre-training objective of this existing technology is masked language modeling, and its joint loss function is mainly designed around the table question-answering task, without targeted optimization for the table cell text classification task. For the task of identifying sensitive data fields in financial tables, there is a target bias between the pre-training task and the downstream classification task, resulting in insufficient ability of the feature representation learned by the encoder to distinguish field types.

[0005] Second, the existing technology mainly uses cross-entropy loss during training, without fully considering the constraints of sample similarity on the feature space distribution in classification tasks. When fields of different categories are highly similar semantically, relying solely on conventional cross-entropy loss is insufficient to effectively separate the inter-class distance, thus affecting classification accuracy.

[0006] Third, existing table processing methods often decompose tables into unstructured plain text streams for encoding, severely losing the table's row and column structure information. Although the aforementioned comparison files retain two-dimensional structural information to some extent through dual-axis positional encoding, their pre-training and fine-tuning stages are independent. The table structure information learned during the pre-training stage is prone to being forgotten or degraded during downstream task adaptation, making collaborative optimization under a unified objective function impossible. Summary of the Invention

[0007] To address the aforementioned shortcomings of existing technologies, this invention provides a deep learning-based method, system, medium, and device for recognizing tabular data. The aim is to solve the problems in existing tabular processing methods, such as insufficient feature discrimination due to the deviation between the pre-training task and the classification task objectives, the difficulty of effectively widening the inter-class distance using conventional cross-entropy loss, and the easy degradation of tabular structure information in downstream tasks.

[0008] In a first aspect, the present invention provides a deep learning-based method for recognizing tabular data, comprising the following steps: Step 1: Input a table containing at least one text field. Standardize the table data by row and column, concatenate the field information in each cell into a text data, remove special and useless characters, unify capitalization, remove extra whitespace, unify date and number formats, and convert the encoding to UTF-8 format to obtain the standardized text corresponding to each cell.

[0009] Step two: Each standardized text is segmented using a word segmenter to obtain several sub-word units, including single-character words, two-character words, multi-character words, and field types. Each sub-word unit is randomly initialized into an embedding vector of a preset dimension using a word embedding algorithm, and a position code is generated for each sub-word unit. The position code is uniquely determined by the row number and column number of the cell it belongs to, and is used to represent the row and column position information of the text in the table. The embedding vector and the position code are added together to obtain the embedding representation of each sub-word unit.

[0010] Step 3: Input the embedded representation of each sub-word unit into an encoder built on the Transformer architecture. The encoder includes a self-attention network and a feedforward network. The self-attention network creates a query vector, a key vector, and a value vector for the embedding vector of each sub-word unit. By calculating the attention weights between the query vector and the key vector, the feature information of each sub-word unit that it pays attention to its context sub-word units is obtained. After iterative processing by the self-attention network and the feedforward network, the context feature vector of each sub-word unit is output. Sub-word units of a preset proportion are randomly masked in rows or columns, and the encoder is pre-trained using the mask cross-entropy loss function.

[0011] Step 4: After pre-training, the context feature vectors of each word unit belonging to the same cell are summed to obtain the feature vector of the cell text. A classification task layer is added after the encoder. The feature vector of the cell text is input into the classification task layer. After mapping by the classification task layer, the classification probability of the cell text belonging to each preset category is output.

[0012] Step 5: Construct a classification loss function. The classification loss function is designed based on the following principles: data with higher similarity are more likely to be assigned to the same category, and the distance between the classification probability distribution of the data and the true label distribution of the data should be as small as possible. The classification loss function is weighted and combined with the masked cross-entropy loss function in the pre-training stage to form the total loss function. The total loss function is used to jointly optimize the network parameters of the encoder and the parameters of the classification task layer. After the joint optimization is completed, feature extraction is performed on all cell text extracted from the entire table, and the classification result is output based on the classification label.

[0013] Secondly, the present invention provides a deep learning-based tabular data recognition system, the system comprising: The table data standardization module is used to obtain table data containing at least one text field, standardize the table data by row and column, concatenate the field information in each cell into a text data, remove special and useless characters, unify capitalization, remove extra whitespace, unify date and number formats, and convert the encoding to UTF-8 format to obtain the standardized text corresponding to each cell.

[0014] The sub-word embedding representation generation module is used to segment each standardized text using a word segmenter to obtain several sub-word units. The sub-word units include single-character words, two-character words, multi-character words, and field types. Each sub-word unit is randomly initialized into an embedding vector of a preset dimension using a word embedding algorithm, and a position code is generated for each sub-word unit. The position code is uniquely determined by the row number and column number of its cell and is used to represent the row and column position information of the cell text in the table. The embedding vector and the position code are added together to obtain the embedding representation of each sub-word unit.

[0015] The encoder pre-training module is used to input the embedded representations of each sub-word unit into an encoder built on a Transformer architecture. The encoder includes a self-attention network and a feedforward network. The self-attention network creates a query vector, a key vector, and a value vector for the embedding vector of each sub-word unit. By calculating the attention weights between the query vector and the key vector, the feature information of each sub-word unit that it pays attention to its context sub-word units is obtained. After iterative processing by the self-attention network and the feedforward network, the context feature vector of each sub-word unit is output. Sub-word units of a preset proportion are randomly masked in rows or columns, and the encoder is pre-trained using the mask cross-entropy loss function.

[0016] The cell feature extraction module is used to sum the context feature vectors of each sub-word unit belonging to the same cell after pre-training to obtain the feature vector of the cell text.

[0017] The classification prediction module is used to add a classification task layer after the encoder. The feature vector of the cell text is input into the classification task layer, and after mapping by the classification task layer, the classification probability of the cell text belonging to each preset category is output.

[0018] The joint optimization module is used to construct a classification loss function, which is designed based on the following principles: data with higher similarity are more likely to be assigned to the same category, and the distance between the classification probability distribution of the data and the true label distribution of the data should be as small as possible. The classification loss function is weighted and jointly combined with the masked cross-entropy loss function in the pre-training stage to form the total loss function. The total loss function is used to jointly optimize the network parameters of the encoder and the parameters of the classification task layer. After the joint optimization is completed, feature extraction is performed on all cell text extracted from the entire table, and the classification result is output based on the classification label.

[0019] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the deep learning-based tabular data recognition method described in the first aspect.

[0020] Fourthly, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the deep learning-based tabular data recognition method described in the first aspect above.

[0021] Compared with the prior art, the present invention has the following beneficial effects: I. Collaborative optimization of pre-training and classification tasks to overcome insufficient feature discrimination ability caused by target bias. Existing table processing methods employ general training objectives such as masked language modeling during the pre-training phase, and question-answering task loss and table header association loss during the downstream task phase. This results in a significant target bias between the pre-training task and the downstream classification task, leading to insufficient discriminative ability of the encoder's learned feature representations for field type identification. Furthermore, the existing paradigm of independent pre-training and fine-tuning phases means that the table structure information learned during pre-training is prone to being forgotten or degraded during downstream task adaptation.

[0022] This invention breaks through the aforementioned technical paradigm by weightedly combining the masked cross-entropy loss function from the pre-training stage with the classification loss function from the downstream classification task to form a unified total loss function. This enables end-to-end joint optimization of the encoder network parameters and the classification task layer parameters. Simultaneously, this invention performs random masking on a row or column basis during the pre-training stage, allowing the encoder to consciously learn the structural relationships between text in cells within the same row or column of the table during pre-training. The synergistic effect of these technical features ensures that the encoder is simultaneously constrained by both the reconstruction and discrimination objectives during parameter updates. This achieves synergistic optimization of preserving table structural information and enhancing classification discrimination capabilities, effectively overcoming the technical defects caused by the inconsistency between pre-training and fine-tuning objectives in existing technologies.

[0023] II. Introducing sample similarity constraints significantly improves the classification accuracy of semantically similar fields. Existing techniques primarily use cross-entropy loss as the training objective, failing to adequately consider the constraints of sample similarity on feature space distribution in classification tasks. In table text classification tasks, fields from different categories may exhibit high semantic similarity (e.g., "customer name" vs. "bank name", "issue date" vs. "tender start date"). Relying solely on conventional cross-entropy loss is insufficient to effectively widen the inter-class distance and compress the intra-class distance, leading to blurred classification boundaries.

[0024] This invention constructs a specialized classification loss function, designed based on the principles that data with higher similarity are more likely to be assigned to the same category, and the distance between the classification probability distribution and the true label distribution of the data should be as small as possible. This loss function, by introducing a similarity metric between samples, imposes explicit constraints on the geometric structure of the feature space, making similar samples more clustered and dissimilar samples more dispersed. Compared to conventional cross-entropy loss in existing technologies, this invention achieves a substantial improvement in the ability to distinguish semantically similar fields.

[0025] III. Hierarchical Feature Extraction Architecture for Deep Integration of Table Structure and Semantic Information Existing technologies for processing tabular data often employ a method of flattening the table into a one-dimensional sequence before encoding, or, although dual-axis positional encoding is introduced, the positional information is not jointly optimized with the classification task, resulting in the structured relationships between rows and columns, and between cells and fields in the table not being fully explored and utilized.

[0026] This invention constructs a hierarchical feature extraction chain from positional encoding, sub-word-level contextual encoding to cell-level feature aggregation. Specifically: positional encoding is uniquely determined by the row and column numbers of a cell, enabling the encoder to perceive the spatial location of each cell in the table; a Transformer-based self-attention network extracts the contextual features of each sub-word unit, allowing the model to capture semantic relationships across cells; the feature vectors of all sub-word units belonging to the same cell are summed to obtain the overall feature representation of the cell text. These three levels cooperate and progress step by step, so that the final output cell text feature vector simultaneously contains two-dimensional structural information, local semantic information, and global contextual information. The overall effect of this hierarchical architecture is significantly better than the simple superposition of various technical features, demonstrating the integrated innovation of the technical solution of this invention.

[0027] IV. End-to-end joint optimization simplifies the training process and improves model performance Existing technologies employ a two-stage training paradigm of pre-training and fine-tuning, which is not only complex in its training process but also suffers from degradation of the table structure information learned in the pre-training stage due to the inconsistency of the goals in the two stages. This invention combines a weighted joint approach of masked cross-entropy loss and classification loss, achieving end-to-end joint optimization from the original table input to the classification result output. This simplifies the training process and avoids the information loss caused by multi-stage training. This technical solution significantly improves the classification accuracy of table text fields while maintaining the model's sensitivity to table structure information.

[0028] In summary, this invention has achieved significant progress in terms of accuracy in classifying table text fields, ability to distinguish semantically similar categories, ability to preserve table structure information, and simplicity of training process by optimizing the pre-training masking strategy, designing a targeted classification loss function, constructing a hierarchical feature extraction architecture, and introducing an end-to-end joint optimization mechanism. Attached Figure Description

[0029] Figure 1 This is an overall flowchart of the method described in Embodiment 1 of the present invention; Figure 2 This is a flowchart of the tabular data standardization processing sub-process provided in Embodiment 1 of the present invention; Figure 3 This is a schematic diagram of the fusion of word embedding representation generation and position encoding provided in Embodiment 1 of the present invention; Figure 4 This is a schematic diagram of the encoder pre-training and masking strategy provided in Embodiment 1 of the present invention; Figure 5 This is a layer structure diagram of the cell text feature extraction and classification task provided in Embodiment 1 of the present invention; Figure 6This is a flowchart of the joint loss function construction and parameter optimization provided in Embodiment 1 of the present invention; Figure 7 This is a module architecture diagram of the system described in Embodiment 2 of the present invention. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below with reference to specific embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.

[0031] I. Definitions In this invention, unless otherwise expressly stated, the following terms have the following meanings: Tabular data: refers to a structured collection of data consisting of at least one row and one column, containing text fields. Its cells may contain information such as text, numbers, dates, and symbols.

[0032] Sub-words: These are the basic language units obtained after segmenting text data using a word segmenter. Their granularity is between that of characters and words. Sub-words include, but are not limited to, single-character words, two-character words, multi-character words, and field type identifiers.

[0033] Location encoding: refers to the feature vector used to characterize the spatial position of each sub-word unit in the original table, which is uniquely determined by the row number and column number of the cell where the sub-word is located.

[0034] Self-attention network: refers to the core component of the Transformer architecture. By calculating the attention weights between each element in the input sequence and other elements, the model is able to capture the dependencies within the sequence.

[0035] II. Example 1 (Method Example) This embodiment provides a deep learning-based method for recognizing tabular data. This method can be applied to bill recognition scenarios in the financial industry to automatically identify sensitive data fields (such as customer names, business transaction numbers, data security classifications, etc.) in Excel spreadsheets, thereby replacing manual verification and improving work efficiency.

[0036] Figure 1 The overall method flow of Embodiment 1 of the present invention is shown below: Step 1: Data Acquisition and Standardization Input a table containing at least one text field. Standardize the table data by row and column, concatenating the field information from each cell into a single text data entry.

[0037] like Figure 2 As shown, the standardization process includes: removing special and useless characters (e.g., standardizing "bank_no" to "bankno"), unifying capitalization, removing extra whitespace, standardizing date and number formats (e.g., standardizing "2023 / 01 / 15" to "2023-01-15"), and converting the encoding to UTF-8. After the above processing, the entire table is represented as an m x n matrix, where each element represents the standardized text of the corresponding cell.

[0038] In this embodiment, a financial business table is input. The table has 5 columns, corresponding to "data type", "field English name", "field Chinese name", "data length" and "data security category", and has 10 rows of data records.

[0039] Step 2: Subword Segmentation and Embedding Representation Generation Figure 3 It demonstrates the process of word segmentation, word embedding vector generation, positional encoding generation, and the fusion of the two to form the final embedding representation.

[0040] For the standardized text data obtained in step one, a word segmenter is used to divide the text in each cell into several sub-word units. Sub-word units include single-character words, two-character words, multi-character words, and field types, etc.

[0041] Assume the word segmentation function is The function takes a cell's normalized text as input. The output is the sequence of subwords obtained after the text is segmented. ,in This indicates the number of subwords extracted from the text in that cell; each element in the sequence represents a subword unit. That is:

[0042] This embodiment uses the jieba word segmentation library to segment the text in the table, for example, segmenting "customer name" into... =“Customer” and = "Name" is a two-word unit; the number of sub-words at this time is... =2; split "CUST_NAME" into =“CUST” and =“NAME” two sub-word units.

[0043] Subsequently, a word embedding algorithm is used to randomly initialize each subword with an embedding vector of a preset dimension, and a positional code is generated for each subword. Let the word embedding function be... The input to this function is a sub-word unit. The output is the embedding vector of the word. Let the position encoding function be... The input to this function is the row number of the cell containing the subword. and column number The output is the position code of that cell. Adding the two together yields the final embedding representation of the word:

[0044] The embedding representation contains semantic information about the subwords and their spatial location information in the table.

[0045] In this embodiment, the dimension of the embedding vector is set to 768. Position encoding is generated using learnable row and column embedding tables: row and column embedding matrices are pre-constructed, and for each position located at the... Line number The cell in column 1, whose row position is encoded as the row embedding matrix of column 2. The row vector and column position are encoded as the first row of the column embedding matrix. The column vectors are summed to obtain the position code of the cell.

[0046] For example, if the cell containing the sub-word "customer" is located in the second row and third column of the table (both row and column numbers start counting from 0), then the row index of this cell is 1 and the column index is 2. Take the vector from the first row of the row embedding table and the vector from the second column of the column embedding table, add the two together, and then add them to the word embedding vector of "customer" to obtain the final embedding representation of the sub-word "customer".

[0047] After generating the embedded representations of all sub-words within all cells, the sub-words of all cells need to be concatenated into a complete one-dimensional sequence in row-major order. Specifically, for a table with multiple rows and columns, the embedded representations of each sub-word are arranged sequentially according to the order of all sub-words in the first cell of the first row, the first cell of the first row, the second cell of the first row, and so on, until all sub-words in the last cell of the last row, forming the sub-word embedded sequence of the entire table.

[0048] In this embodiment, the sub-word dictionary is constructed by the user based on business usage. It mainly includes some fields from banking business-related tables, such as "business transaction number", "operator number", "business date", etc., containing a total of 18,560 words.

[0049] Step 3: Encoder Pre-training Figure 4 The self-attention network structure, feedforward network structure, and pre-training strategy of random masking on a row-by-row basis are explained.

[0050] The full-table word embedding sequence generated in step two is input into an encoder built on the Transformer architecture. The encoder consists of a self-attention network and a feedforward neural network.

[0051] In this embodiment, the encoder comprises 5 network layers, each consisting of a self-attention network and a feedforward network. The number of self-attention heads is set to 8, and the hidden layer dimension of the feedforward network is set to 768.

[0052] Embedding representation is first processed through a self-attention network. When extracting feature information from subwords, the self-attention network focuses not only on the semantics of the subword itself but also on the contextual relationships between the subword and other subwords. Specifically, the self-attention network creates a query vector, a key vector, and a value vector for each subword's embedding vector. These three vectors have the same dimension, equal to the hidden layer dimension divided by the number of self-attention heads. In this embodiment, the hidden layer dimension is 768, and the number of self-attention heads is 8, resulting in a 96-dimensional vector for each vector. By calculating the dot product between each subword's query vector and the key vectors of all subwords, and scaling by the square root of the dimension, followed by Softmax normalization, the attention weights of the subword to other subwords in the context are obtained. These attention weights are then weighted and summed with the corresponding value vectors to obtain the subword's feature vector after incorporating contextual information. This approach allows the model to flexibly consider relevant contextual information when acquiring subword features.

[0053] After processing by a self-attention network, a feedforward neural network is used for nonlinear transformation to further extract higher-level feature representations. After multiple iterative processes, the encoder outputs the context feature vector for each word unit.

[0054] During the pre-training phase, this invention randomly masks 15% of the word units on a row or column basis, and uses the context information of the masked words to predict their true content, constructing a masked cross-entropy loss function for network pre-training. This loss function calculates the cross-entropy between the probability distribution of the masked words predicted by the model and the true labels of the masked words. The smaller the loss value, the more accurate the model's prediction of the masked words. In this embodiment, random masking is performed on a row-by-row basis.

[0055] For example, suppose a row contains five cells with text: "VARCHAR", "CUST_NAME", "Customer Name", "10", and "Sensitive Data". In the segmented sub-word sequence, randomly mask 15% of the sub-words (e.g., ...). =“customer” sub-word masking), the model uses the preceding (e.g., “NAME”) and following (e.g., “name”) of the sub-word to predict the masked “customer” sub-word.

[0056] During the pre-training phase, the AdamW optimizer was used to optimize the network parameters. The batch size was set to 256, the initial learning rate was set to 1e-4, and the learning rate was linearly decayed to 0.

[0057] Step 4: Construction of Cell Text Feature Extraction and Classification Task Layer Figure 5 This demonstrates the process of summing the context feature vectors of each word within the same cell to obtain the cell text feature vector, and then inputting it into the classification task layer (fully connected network + Softmax) to output the classification probability.

[0058] After pre-training, the context feature vectors of each sub-word unit belonging to the same cell are summed to obtain the overall feature vector of the cell's text. For example, for the "Customer Name" cell, it contains... =“Customer” and =The two sub-words "name" are used to add the context feature vectors of these two sub-words together to obtain a fused feature vector, which represents the semantic information of the entire cell text.

[0059] A classification task layer is added after the encoder. The classification task layer is a fully connected network followed by a Softmax activation function. Let the output of the classification task layer be... ,in This is the weight matrix. This is a bias term. The input is fed into the Softmax function, which takes a vector of real numbers as input. The output is a probability distribution. Each element represents the probability that the text in the cell belongs to the corresponding category, and the sum of the probabilities of all categories is 1. For example, for the "Customer Name" cell, the probability distribution output by the classification task layer might be: sensitive data accounts for 85%, ordinary data accounts for 10%, and non-sensitive data accounts for 5%.

[0060] Step 5: Construction and Parameter Optimization of Joint Loss Function Figure 6 This paper demonstrates the process of constructing a total loss function by weighting the classification loss function and the mask cross-entropy loss function, and then using the total loss function to jointly optimize the encoder parameters and the classification task layer parameters.

[0061] Based on the fundamental principle that the probability of a text field being assigned to the true label should be maximized, a classification loss function is designed. If the true label of a text field is represented by a one-hot vector, where the position corresponding to the true category is 1 and the rest are 0, then the classification loss function calculates the cross-entropy between the model's predicted classification probability distribution and this one-hot vector. The smaller this loss value, the closer the model's predicted classification result is to the true label.

[0062] In this embodiment, the classification loss function L is composed of a weighted sum of the cross-entropy loss L1 and the center loss L2, and its expression is: L=L1+ *L2 in, These are non-negative weighting coefficients used to adjust the relative importance of the center loss. In this embodiment, It was initially set to 0.01 and then tuned on the validation set.

[0063] Cross-entropy loss L1 measures the difference between the model's predicted classification probability distribution and the true label distribution. The calculation method for cross-entropy loss is as follows: first, iterate through all possible categories, multiplying the true label value (0 or 1) of each category by the logarithm of the model's predicted probability for that category; then, sum all the products and finally take the negative value.

[0064] L2 center loss is used to constrain feature vectors of similar samples to cluster towards their class center, thereby enhancing intra-class compactness and inter-class separability of features. The center loss is calculated as follows: first, calculate the difference between the feature vector of a sample and the center vector of its class; then calculate the Euclidean distance of this difference vector (i.e., the square root of the sum of the squares of the differences of each component); then square this distance; and finally multiply it by one-half.

[0065] During training, the feature centers of each category are treated as learnable parameters and updated synchronously with the network's weight parameters. To avoid excessive perturbation of the category centers by outliers, a momentum update strategy is adopted, which uses only the feature mean of samples belonging to that category within the current training batch to progressively correct the centers.

[0066] The specific update method for the category center consists of two steps: The first step is to calculate the center update for that class. The update is equal to: summing the differences between the feature vector of each sample and the current center vector of that class for all samples belonging to that class, and then dividing by the number of samples in that class plus one. The indicator function is used to determine whether a sample belongs to that class.

[0067] The second step involves updating the category centers as follows: the new center vector equals the current center vector minus the center learning rate multiplied by the update amount calculated in the first step. In this embodiment, the center learning rate is set to 0.5.

[0068] By minimizing the center loss, the feature vectors of cell text of the same category are constrained to the vicinity of their category center in the feature space, while the centers of different categories are far apart, thus effectively alleviating the problem of blurred category boundaries caused by semantic similarity. The weighted combination of cross-entropy loss and center loss not only ensures the accuracy of classification prediction but also optimizes the geometric structure of the feature space, significantly improving the ability to distinguish semantically similar fields.

[0069] The classification loss function described above is weighted and combined with the masked cross-entropy loss function from step three to form the total loss function. In this embodiment, the total loss function is expressed as the masked cross-entropy loss plus the classification loss multiplied by the balance parameter. The balance parameter is a non-negative constant used to adjust the relative importance of the two loss functions in the total loss. In this embodiment, the balance parameter is initialized to 1 and then fine-tuned based on the data recognition results. Experiments show that the model performance is optimal when the balance parameter is set to 0.8.

[0070] The network parameters of the encoder and the classification task layer are jointly optimized using the total loss function. The encoder parameters saved during the pre-training phase are used as the initial values ​​for the fine-tuning phase. Together with the newly added classification task layer parameters, end-to-end optimization is performed by minimizing the joint loss function. The advantage of joint optimization is that the masked cross-entropy loss in the pre-training phase enables the encoder to learn the structural information of the table and general semantic features, while the classification loss enables the encoder and classification task layer to be adapted to the classification task. The two are optimized collaboratively under the same objective function, avoiding the information loss caused by separating the pre-training and fine-tuning phases.

[0071] After joint optimization, feature extraction is performed on all cell text extracted from the entire table, and classification results are output based on classification labels. For example, for the aforementioned table with 5 columns and 10 rows, the model outputs the prediction result for the "Data Security Classification" column in each row, automatically labeling sensitive data fields.

[0072] III. Example 2 (System Example) This embodiment provides a deep learning-based tabular data recognition system, which implements the method described in Embodiment 1. The system adopts a client-server architecture, where the model training part is deployed on the server side, and the model inference part can be deployed on the server side or the edge device. Figure 7 The module architecture diagram of the deep learning-based tabular data recognition system provided in Example 2 shows the data flow relationship between the modules.

[0073] The system includes: The table data standardization module is used to acquire table data containing at least one text field, standardize the table data by row and column, concatenate the field information in each cell into a single text data, remove special and useless characters, unify capitalization, remove extra whitespace, unify date and number formats, and convert the encoding to UTF-8 format to obtain the standardized text corresponding to each cell. The specific implementation of this module is the same as step one of Example 1.

[0074] The sub-word embedding representation generation module is used to segment each standardized text using a word segmentation function to obtain a sub-word sequence. The sub-word units include single-character words, two-character words, multi-character words, and field types. Each sub-word unit is randomly initialized into an embedding vector of a preset dimension using a word embedding function, and a positional encoding function is used to generate a positional code for each sub-word unit. This positional code is uniquely determined by the row and column numbers of its cell, representing the row and column position information of the text in that cell within the table. The embedding vector and the positional code are added to obtain the embedding representation of each sub-word unit. Finally, all the sub-words from all cells are concatenated into a complete one-dimensional sequence in row-major order. The specific implementation of this module is the same as step two of Example 1.

[0075] The encoder pre-training module is used to input the embedding representation sequence of each sub-word unit into an encoder built on a Transformer architecture. The encoder includes a self-attention network and a feedforward network. The self-attention network creates a query vector, key vector, and value vector for each sub-word's embedding vector. By calculating the attention weights between the query vector and the key vector, it obtains the feature information of each sub-word unit that it focuses on its context sub-word units. After iterative processing by the self-attention network and the feedforward network, it outputs the context feature vector of each sub-word unit. Then, it randomly masks 15% of the sub-word units by row or column, and pre-trains the encoder using the masked cross-entropy loss function. The specific implementation of this module is the same as step three in Example 1.

[0076] The cell feature extraction module is used to sum the context feature vectors of each sub-word unit belonging to the same cell after pre-training to obtain the feature vector of the cell text. The specific implementation of this module is the same as the feature extraction part in step four of Example 1.

[0077] The classification prediction module adds a classification task layer after the encoder. The feature vector of the cell text is input into the classification task layer, and the probability distribution is output through the Softmax function to obtain the classification probability of the cell text belonging to each preset category. The specific implementation of this module is the same as the classification task layer part in step four of Example 1.

[0078] The joint optimization module is used to construct a classification loss function, which is designed based on the following principles: data with higher similarity are more likely to be assigned to the same category, and the distance between the classification probability distribution and the true label distribution of the data should be as small as possible. The classification loss function is weighted and jointly combined with the masked cross-entropy loss function from the pre-training stage to form the total loss function, which is expressed as the masked cross-entropy loss plus the classification loss multiplied by a balance parameter. The balance parameter is initialized to 1 and finally determined to be 0.8. The total loss function is used to jointly optimize the network parameters of the encoder and the parameters of the classification task layer. After the joint optimization is completed, feature extraction is performed on all cell text extracted from the entire table, and the classification result is output based on the classification label. The specific implementation of this module is the same as step five of Example 1.

[0079] In this embodiment, the six modules are connected in series: the output of the table data standardization module serves as the input of the sub-word embedding representation generation module; the output of the sub-word embedding representation generation module serves as the input of the encoder pre-training module; the output of the encoder pre-training module serves as the input of the cell feature extraction module; the output of the cell feature extraction module serves as the input of the classification prediction module; and the output of the classification prediction module serves as the input of the joint optimization module. The modules communicate with each other through a data interface. In actual deployment, the system may also include a model storage module for storing the encoder parameters and classification task layer parameters after training, and a model inference module for quickly predicting new table data.

[0080] IV. Example 3 (Application Scenario Example - Identification of Sensitive Data in Financial Statements) This embodiment applies the method described in Embodiment 1 to the daily report processing workflow of a financial institution. The institution receives approximately 500 business reports in Excel format daily, each containing 20 to 50 columns of tabular data, including fields such as customer information, transaction records, and account balances. According to regulatory requirements, sensitive data fields in the reports (including customer names, ID numbers, bank account numbers, and transaction amounts) need to be automatically identified and labeled to implement differentiated data security controls.

[0081] Before applying the method of this invention, the organization used manual verification to identify sensitive data. Each report required an average of 15 minutes of manual processing time, and the identification accuracy rate was about 85%, with cases of omissions and mislabeling.

[0082] The specific implementation process using the method of this invention is as follows: First, the daily received Excel reports are input into the trained table data recognition model through a standardized interface. The model standardizes the text content of each cell, including removing spaces, standardizing date formats, and converting encodings. Then, a word segmenter is used to segment the text of each cell. In this embodiment, a word segmentation dictionary containing approximately 18,560 financial-related terms is customized based on the characteristics of the financial field, such as "business transaction number," "operator number," and "business date."

[0083] Next, the embedding vector of each word is added to its positional encoding and then fed into the encoder. The encoder uses a self-attention mechanism to capture contextual features within and across cells. For example, for the "Customer Name" column, the model can use information from columns such as "ID Number" and "Bank Account Number" in the same row to help confirm that "Customer Name" is a sensitive data field. Simultaneously, the model is pre-trained by randomly masking 15% of the words per row, enabling it to learn the structural relationships between fields within the same row.

[0084] After pre-training, the model sums the sub-word feature vectors of each cell to obtain the cell text feature vector, and outputs the classification probability of each cell belonging to "sensitive data" or "non-sensitive data" through the classification task layer. During joint optimization, the classification loss function forces highly similar sensitive data fields to cluster more in the feature space, thereby effectively distinguishing non-sensitive data that is semantically similar to sensitive data. The balancing parameter is set to 0.8.

[0085] After a month of actual operation, statistical results show that the average processing time for each report has been reduced to less than 30 seconds, the accuracy rate of sensitive data identification has reached over 96%, and the false alarm rate has been reduced to below 2%. This application scenario fully verifies the effectiveness and efficiency of the method of this invention in financial table data processing.

[0086] V. Example 4 (Application Scenario Example - Adaptive Recognition of Heterogeneous Table Structures) This embodiment applies the system described in Embodiment 2 to a scenario involving heterogeneous table data with multiple formats and structures. In actual business operations, tables generated by different departments and at different times often have different layout structures, including merged cells, split cells, multiple headers, and inconsistent header positions. Traditional rule-based methods struggle to adapt to this diversity, while the method of this invention, with its deep learning-based feature extraction capabilities, can adaptively handle heterogeneous tables.

[0087] Taking the processing of two business ledgers with different structures as an example: the header of the first ledger is located in the first row, and the column names include "Serial Number", "Product Code", "Product Name", "Issuance Date" and "Maturity Date"; the header of the second ledger is located in the third row (the first two rows are the title and remarks information), and the column names include "Product Code", "Full Product Name", "Interest Commencement Date" and "Payment Date".

[0088] When processing data using the system of this invention, the table data feature extraction module first detects the actual header position of each table. By judging format features such as merged cells, bold font, and background color, as well as semantic features of cell text, it automatically identifies the header row and header column. Then, it generates an embedded representation containing row and column position information for each cell, enabling the model to perceive the positional differences of the same semantic column in different tables.

[0089] The encoder learns the mapping relationships between semantically similar column names such as "product code" and "product code", "issue date" and "interest accrual date", and "maturity date" and "payment date" through a self-attention mechanism. Finally, the classification training module outputs the mapping results of each column of data to the standard fields in the database.

[0090] Experimental results show that the method achieves an accuracy of over 94% in field mapping on a test set containing 100 different table formats, significantly outperforming rule-based methods (accuracy of approximately 65%) and traditional machine learning-based methods (accuracy of approximately 78%). This embodiment demonstrates that the method of the present invention has strong generalization ability and robustness.

[0091] VI. Example 5 (Media Example) This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the deep learning-based tabular data recognition method described in Embodiment 1.

[0092] The computer-readable storage media include, but are not limited to: magnetic storage media (such as hard disks, floppy disks, magnetic tapes), optical storage media (such as CD-ROMs, DVDs), semiconductor storage media (such as solid-state drives (SSDs), flash memory, read-only memory (ROMs), random access memory (RAMs), or any combination of the above types.

[0093] In one specific implementation of this embodiment, the computer-readable storage medium is a USB flash drive, which internally stores a computer program containing executable instructions. When the USB flash drive is inserted into a terminal device with data processing capabilities (such as a personal computer, industrial control computer, or server), the processor of the terminal device reads and executes the computer program from the USB flash drive to implement the deep learning-based table data recognition method described in Embodiment 1: that is, the input table data is standardized, the text of each cell is segmented into a sequence of sub-words, sub-word embedding vectors and position codes are generated and added together to obtain an embedding representation, the embedding representation sequence is input into the encoder for pre-training, the sub-word feature vectors of the same cell are summed to obtain the cell text feature vector, the classification probability is output through the classification task layer, the network parameters are optimized using a joint loss function (masked cross-entropy loss plus classification loss multiplied by a balance parameter, the balance parameter is initialized to 1 and finally determined to be 0.8), and the classification result is finally output.

[0094] VII. Example 6 (Equipment Example) This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the deep learning-based tabular data recognition method described in Embodiment 1.

[0095] The electronic devices include, but are not limited to: desktop computers, laptops, tablets, smartphones, servers, industrial control computers, embedded devices, cloud virtual machines, etc.

[0096] In one specific implementation of this embodiment, the electronic device is a server deployed in the data center of a financial institution. The server is equipped with a multi-core central processing unit and a graphics processing unit to accelerate the training and inference process of the deep learning model. The processor reads the table data recognition program from memory and loads it into memory to run, implementing the deep learning-based table data recognition method described in Embodiment 1, recognizing the received table data, and outputting the classification result for each cell.

[0097] In another specific implementation of this embodiment, the electronic device is a smartphone that integrates a lightweight, compressed table data recognition model. The user takes a photo of the paper table using the phone's camera. The phone's operating system automatically uses optical character recognition (OCR) to convert the table in the photo into structured data. Then, the built-in table data recognition program processes this structured data, ultimately displaying the classification result for each cell on the phone screen. This implementation is suitable for mobile office scenarios, such as field personnel collecting invoice information and annotating sensitive data.

[0098] VIII. Experimental Verification To verify the table recognition performance of this invention, a batch of commonly used business data tables in the financial industry were input, and existing technologies were used to identify sensitive fields in the table data. The actual effects of this invention and existing technical solutions were compared. The comparison methods used in the experiment included: a method using only the BERT model, and a method combining the BERT model with dual-axis positional encoding. Evaluation metrics included accuracy (ACC), normalized mutual information (NMI), and F1 score.

[0099] Experimental results show that the BERT-only method achieves scores of 0.689, 0.528, and 0.659 on the three metrics; the BERT combined with dual-axis positional encoding method achieves scores of 0.756, 0.677, and 0.689 on the three metrics; while the method of this invention achieves scores of 0.812, 0.748, and 0.807 on the three metrics, all significantly outperforming the two existing methods. These experimental results fully demonstrate the effectiveness and advancement of the technical solution of this invention.

[0100] IX. Limitations and Claims Regarding the Scope of Protection The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. It should be understood that those skilled in the art can make various modifications, equivalent substitutions, and improvements to the above embodiments without departing from the spirit and principle of the present invention, and all such modifications, equivalent substitutions, and improvements should be included within the protection scope of the present invention.

[0101] It should be further noted that the "computer-readable storage medium" described in this invention is not limited to physical storage media in the traditional sense, but also includes non-physical storage media such as cloud storage space and network storage devices; the "electronic device" described in this invention is not limited to a single physical device, but also includes various deployment forms such as distributed computing systems, cloud server clusters, and edge computing nodes. Any device, medium, or combination thereof that uses the method described in this invention to identify tabular data, regardless of its specific hardware form, falls within the protection scope of this invention.

[0102] It is particularly important to note that the core of the deep learning-based table data recognition method, system, medium, and device protected by this invention lies in the synergistic effect of a row- or column-based mask pre-training strategy, a classification loss function design based on sample similarity constraints, a hierarchical feature extraction architecture, and an end-to-end joint optimization mechanism to achieve accurate classification of table text fields. Any conventional adjustments to the encoder structure (including but not limited to the number of Transformer layers, the number of attention heads, and the dimension of hidden layers), replacements of the word segmenter type, changes to the positional encoding generation method, and optimizations of the loss function balance parameters based on the technical solution of this invention are all conventional technical means for those skilled in the art and should not be considered as a substantial limitation on the scope of protection of this invention.

Claims

1. A deep learning-based method for recognizing tabular data, characterized in that, Includes the following steps: The input table data is standardized to obtain the standardized text corresponding to each cell; Each standardized text is segmented using a word segmenter to obtain several sub-word units. An embedding vector and a position code uniquely determined by the row and column number of the cell are generated for each sub-word unit. The embedding vector and the position code are added together to obtain the embedding representation of each sub-word unit. The embedding representation of each word unit is input into the encoder based on the Transformer architecture, and the context feature vector of each word unit is output. A preset proportion of word units are randomly masked in rows or columns, and the encoder is pre-trained using the mask cross-entropy loss function. After pre-training, the context feature vectors of each word unit belonging to the same cell are aggregated to obtain the feature vector of the cell text. A classification task layer is added after the encoder. The feature vector of the cell text is input into the classification task layer, and the classification probability of the cell text belonging to each preset category is output. A classification loss function is constructed, which is a weighted sum of cross-entropy loss and center loss. The classification loss function and the mask cross-entropy loss function are weighted and combined to form the total loss function. The total loss function is used to jointly optimize the network parameters of the encoder and the parameters of the classification task layer. After the joint optimization is completed, the classification result is output.

2. The deep learning-based tabular data recognition method according to claim 1, characterized in that, The position code is generated using a learnable row embedding table and column embedding table: a row embedding matrix and a column embedding matrix are pre-constructed. For a cell located in the i-th row and j-th column, its row position code is the i-th row vector of the row embedding matrix, and its column position code is the j-th column vector of the column embedding matrix. The position code of the cell is obtained by adding the two together.

3. The deep learning-based tabular data recognition method according to claim 1, characterized in that, Randomly mask a preset proportion of sub-word units by row or column. Specifically, mask a preset proportion of sub-word units within the same row of a table; or mask a preset proportion of sub-word units within the same column of a table.

4. The deep learning-based tabular data recognition method according to claim 1, characterized in that, The context feature vectors of each sub-word unit belonging to the same cell are aggregated. Specifically, the context feature vectors of each sub-word unit belonging to the same cell are summed to obtain the feature vector of the text in that cell.

5. The deep learning-based tabular data recognition method according to claim 1, characterized in that, The classification task layer is a fully connected network followed by a Softmax activation function.

6. The deep learning-based tabular data recognition method according to claim 1, characterized in that, The center loss is used to constrain the feature vectors of similar samples to converge towards their class center. The center loss and the cross-entropy loss are weighted and summed to form the classification loss function.

7. The deep learning-based tabular data recognition method according to claim 1, characterized in that, The total loss function is expressed as the masked cross-entropy loss plus the classification loss multiplied by the balancing parameter, where the balancing parameter is a non-negative constant.

8. A deep learning-based tabular data recognition system, characterized in that, include: The table data standardization module is used to standardize the input table data and obtain the standardized text corresponding to each cell. The sub-word embedding representation generation module is used to cut each standardized text into several sub-word units using a word segmenter, generate an embedding vector and a position code uniquely determined by the row and column number of the cell for each sub-word unit, and add the embedding vector and the position code to obtain the embedding representation of each sub-word unit. The encoder pre-training module is used to input the embedding representation of each word unit into the encoder based on the Transformer architecture and output the context feature vector of each word unit; it randomly masks a preset proportion of word units by row or column and uses the mask cross-entropy loss function to pre-train the encoder. The cell feature extraction module is used to aggregate the context feature vectors of each sub-word unit belonging to the same cell after pre-training to obtain the feature vector of the cell text. The classification prediction module is used to add a classification task layer after the encoder. It inputs the feature vector of the cell text into the classification task layer and outputs the classification probability of the cell text belonging to each preset category. The joint optimization module is used to construct a classification loss function, which is a weighted sum of cross-entropy loss and center loss. The classification loss function and the mask cross-entropy loss function are weighted and jointly combined to form a total loss function. The total loss function is used to jointly optimize the network parameters of the encoder and the parameters of the classification task layer. After the joint optimization is completed, the classification result is output.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the deep learning-based tabular data recognition method as described in any one of claims 1 to 7.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the deep learning-based tabular data recognition method according to any one of claims 1 to 7.