A method and system for detecting structured sensitive data with adaptive concatenation scale
By employing a structured sensitive data detection method that adapts to splicing scale, and utilizing bidirectional long short-term memory networks and self-spatial attention mechanisms, the problem of poor adaptability to splicing scale changes in structured data detection is solved, achieving high-precision and robust sensitive data detection.
Patent Information
- Application Number
- CN202511300151.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-12
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-09-12
AI Technical Summary
Existing technologies suffer from poor adaptability and insufficient robustness in structured data detection due to variations in splicing scale, making it difficult to effectively handle multi-scale structured sensitive data.
We employ a splicing scale adaptive approach, which involves data preprocessing, feature extraction and fusion steps, and utilizes bidirectional long short-term memory networks, self-attention mechanisms and spatial attention mechanisms to construct globally dependent features and multi-scale local features, generating fused features for classification.
It improves the model's adaptability to different splicing scales, enhances the richness and robustness of feature representations, and improves the recognition accuracy and generalization ability for complex and variant-sensitive data.
Smart Images

Figure CN120804635B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and data security, specifically to a method and system for detecting structured sensitive data with adaptive splicing scale that integrates long short-term memory networks, convolutional neural networks, and spatial attention mechanisms. It is particularly suitable for privacy information classification scenarios in structured text. Background Technology
[0002] With the acceleration of digitalization, the risk of leakage of structured sensitive data is increasing. If such data is maliciously used, it will lead to severe economic losses and a crisis of social trust. Therefore, efficient and accurate sensitive data detection technology has become a core requirement for ensuring data security, and is of great significance for protecting personal privacy, corporate compliance, and national security.
[0003] The main challenge in detecting sensitive information in structured data lies in its inherent lack of context. Unlike traditional continuous text, tabular data structures exhibit the following key characteristics: 1. Semantic fragmentation: Data is divided into independent cells, disrupting natural semantic continuity. 2. Context sparsity: Cells lack explicit semantic relationships, relying instead on implicit structural relationships. 3. Feature dispersion: Sensitive information is often distributed across multiple fields in the form of non-continuous fragments. 4. Semantic confounding: A single cell may contain a mixture of sensitive and non-sensitive information. This lack of multi-dimensional context modeling becomes the fundamental bottleneck restricting detection accuracy and generalization ability. Therefore, the core difficulty in detecting sensitive data in structured data lies in how to perform context modeling.
[0004] Existing technologies generally employ cell concatenation strategies to reconstruct semantic relationships: connecting adjacent fields into a continuous text sequence to simulate the context of natural language. However, this solution faces multi-scale adaptability challenges in practical applications—the distribution of column numbers in structured data is highly unbalanced, and the concatenation scale in real-world business scenarios (i.e., the number of cell data points in a single sample) often far exceeds the coverage of the training set. In this situation, ensuring the accuracy of classification results, the model's generalization ability, and its robustness to rare structural data forms becomes an urgent problem to be solved. Summary of the Invention
[0005] Based on this, the purpose of this invention is to overcome the shortcomings of existing structured sensitive data detection models in terms of poor adaptability and insufficient robustness to changes in splicing scale, and to provide a structured sensitive data detection method and system with adaptive splicing scale.
[0006] In a first aspect, the present invention provides a method for detecting structured sensitive data with adaptive splicing scale, comprising the following steps:
[0007] S1. Data preprocessing steps: Obtain structured data, concatenate multiple fields in the structured data into a text sequence using a preset delimiter, and encode the text sequence using a character set to obtain a character index sequence;
[0008] S2. Feature Extraction and Fusion Steps: This step includes:
[0009] The character index sequence is input into an embedding layer to obtain a character embedding sequence, and then the character embedding sequence is input into a bidirectional long short-term memory network to extract a temporal feature.
[0010] A first feature processing path is established, and the temporal features are input into a self-attention mechanism module. By modeling the global dependency relationship between characters in the text sequence, a global dependency feature is generated.
[0011] Establish a second feature processing path parallel to the first feature processing path, which includes:
[0012] The temporal features are extracted using a multi-scale sliding window to obtain multi-scale local features;
[0013] An intermediate feature is generated by fusing the temporal features with the multi-scale local features through a gating mechanism.
[0014] The intermediate features are input into a spatial attention module, and the intermediate features are weighted to obtain a spatially enhanced feature.
[0015] The global dependency feature and the spatial enhancement feature are concatenated along the feature dimension to obtain a fused feature;
[0016] S3. Classification step: Input the fused features into the classifier to obtain the sensitive data category of the structured data.
[0017] As an optional implementation of the first aspect of this application, the data preprocessing step involves concatenating multiple fields in the structured data into a text sequence using a preset delimiter. Specifically, this includes: statistically analyzing the length distribution of each field based on the training dataset and presetting a concatenation scale threshold λ; for the field to be processed, determining its length; if the field length is greater than the threshold λ, then truncating the field into segments according to the threshold λ length and adding a preset special marker at the end of each truncated segment; if the field length is less than the threshold λ, then looping through the character sequence of the field and filling the end of the original field with the looped character sequence until the total length of the field reaches the threshold λ.
[0018] As an optional implementation of the first aspect of this application, the processing of the self-attention mechanism module in the first feature processing path specifically includes: performing linear transformations on the input temporal features through a first projection matrix, a second projection matrix, and a third projection matrix to generate a query vector Q, a key vector K, and a value vector V; performing matrix multiplication on the transpose of the query vector Q and the key vector K, and scaling and normalizing the result using the Softmax function to calculate an attention weight matrix; and performing matrix multiplication on the attention weight matrix and the value vector V to obtain the weighted aggregated global dependency features.
[0019] As an optional implementation of the first aspect of this application, in the second feature processing path, a multi-scale sliding window is used to extract features from the temporal features to obtain a multi-scale local feature. Specifically, this includes: pre-setting a sliding window scale set containing at least two different integers; for each scale s in the multi-scale sliding window scale set, padding both ends of the temporal dimension of the character embedding sequence with s / 2 zero vectors to obtain a padded sequence; for each time step of the padded sequence, extracting all feature vectors within a window centered on that time step and with a width of s, and calculating their weighted sum to obtain a single-scale sliding window feature at scale s; concatenating the single-scale sliding window features obtained at all scales along the feature dimension, and then compressing the dimension of the concatenated feature to be consistent with the hidden layer dimension of the temporal features through a linear transformation layer to obtain the multi-scale local feature.
[0020] As an optional implementation of the first aspect of this application, in the second feature processing path, a gating mechanism is used to fuse the temporal features and the multi-scale local features to generate an intermediate feature. Specifically, this includes: concatenating the temporal features and the multi-scale local features or performing element-wise operations, inputting the result into a linear layer, and then calculating an interaction weight gating value through a Sigmoid activation function. ; Utilizing the aforementioned interactive weight gate value The time-series features are weighted, and 1- The multi-scale local features are weighted, and the two weighted results are added together to obtain the intermediate features.
[0021] As an optional implementation of the first aspect of this application, the spatial attention module in the second feature processing path specifically includes: performing average pooling and max pooling operations along the channel dimension of the intermediate feature to obtain an average pooling feature descriptor and a max pooling feature descriptor; concatenating the average pooling feature descriptor and the max pooling feature descriptor along the channel dimension to form an enhanced feature descriptor; inputting the enhanced feature descriptor into a two-dimensional convolutional layer configured with a single output channel and using zero padding for convolution operation, and then processing the convolution result through a Sigmoid activation function to generate a spatial attention mask; multiplying the spatial attention mask element-wise with the input intermediate feature to obtain the spatial enhanced feature.
[0022] As an optional implementation of the first aspect of this application, the data preprocessing step involves encoding the text sequence into a character set to obtain a character index sequence. Specifically, this includes: traversing the training dataset, counting all occurrences of characters, and constructing a character-to-index mapping dictionary, wherein... <pad>Indicates padding characters and uses <unk>This indicates a character not found in the database; based on the mapping dictionary, each character in the text sequence is converted into its corresponding unique index. If a character is not in the dictionary, it is converted to... <unk>The corresponding indices form an initial index sequence; it is then determined whether the length of the initial index sequence is less than a preset maximum sequence length. If so, the end of the initial index sequence is padded with the corresponding indexes. <pad>The corresponding index is used until the sequence length equals the maximum sequence length to obtain the character index sequence.
[0023] Secondly, embodiments of this application provide a structured sensitive data detection system with adaptive splicing scale, including:
[0024] The data preprocessing module is used to acquire structured data, concatenate multiple fields in the structured data into a text sequence using a preset delimiter, and encode the text sequence into a character set to obtain a character index sequence.
[0025] The feature extraction and fusion module is used to input the character index sequence into an embedding layer to obtain a character embedding sequence, and then input the character embedding sequence into a bidirectional long short-term memory network to extract a temporal feature; establish a first feature processing path, input the temporal feature into a self-attention mechanism module, and generate a global dependency feature by modeling the global dependencies between characters in the text sequence; establish a second feature processing path parallel to the first feature processing path, which includes: extracting features from the temporal feature using a multi-scale sliding window to obtain a multi-scale local feature; fusing the temporal feature and the multi-scale local feature through a gating mechanism to generate an intermediate feature; inputting the intermediate feature into a spatial attention module to perform feature weighting on the intermediate feature to obtain a spatially enhanced feature; and concatenating the global dependency feature and the spatially enhanced feature along the feature dimension to obtain a fused feature;
[0026] The classification module is used to input the fused features into the classifier to obtain the sensitive data categories of the structured data.
[0027] Thirdly, embodiments of this application provide an electronic device, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the steps of the method described in the first aspect.
[0028] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0029] Compared with the prior art, the present invention has the following significant advantages:
[0030] 1. Strong adaptability of splicing scale: Through dynamic splicing preprocessing, the feature sparsity problem caused by uneven field length is effectively alleviated, enabling the model to better handle input data with different splicing scales.
[0031] 2. Rich feature representation: Combining LSTM, multi-scale sliding window, spatial attention and self-attention mechanisms, features are extracted from multiple dimensions such as temporal dependence, local patterns, key regions and global correlations, and a comprehensive and robust feature representation is constructed.
[0032] 3. High detection accuracy: The spatial attention mechanism can focus on the key character region where sensitive information is located, and the self-attention mechanism can capture scattered contextual relationships. The combination of the two significantly improves the recognition accuracy of complex and variant sensitive data.
[0033] 4. Good robustness: For rare or unknown splicing forms of data that differ significantly from the training data structure, this method demonstrates stronger generalization ability and detection robustness through multimodal feature fusion and dual attention mechanism. Attached Figure Description
[0034] Figure 1 This is a flowchart of a structured sensitive data detection method with adaptive splicing scale according to an embodiment of the present invention;
[0035] Figure 2 This is a schematic diagram of a structured sensitive data detection system with adaptive splicing scale provided in an embodiment of the present invention.
[0036] The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation
[0037] 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, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0038] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0039] Example 1
[0040] Please see Figure 1 This is a flowchart illustrating a structured sensitive data detection method with adaptive splicing scale provided by an embodiment of the present invention. The method may include the following steps:
[0041] S1. Data preprocessing steps: Obtain structured data, concatenate multiple fields in the structured data into a text sequence using a preset delimiter, and encode the text sequence using a character set to obtain a character index sequence.
[0042] One preset scenario of this embodiment is to detect and classify structured sensitive data stored in a database in a tabular format. Taking a column of data with the header "Organization" and the content "[Estet InterierD.OO, lincoln county government, Leavitt Area High School, Town HealthCorporate Advisory And Investments Limited, Cologica Scientific]" as an example, we will illustrate the operation process of the method of this invention.
[0043] Specifically, step S1 includes the following steps:
[0044] S11, Data Preprocessing.
[0045] Data preprocessing adopts the methods of mainstream structured sensitive data processing, and processes a small number of columns of data. Connected by specific delimiters, they form a piece of text, which can be used as an independent sample. This represents the data in the i-th column. (Using...) To represent the data splicing process, a single sample can be represented as To address the multi-scale distribution problem caused by significant differences in the length of sensitive fields in structured data, a dynamic splicing strategy is proposed. First, the length distribution of sensitive information for each field is statistically analyzed, and a splicing scale threshold λ is set (e.g., λ=0.8, indicating that 80% of the field lengths are shorter than this value). For fields exceeding λ in length, a segmentation truncation + dynamic padding strategy is adopted.
[0046] If the field length is greater than λ, then truncate it into segments of λ and add a special marker at the end;
[0047] If the field length is less than λ, then fill the field with data until the length is λ (e.g., fill "abc" with "abcabc").
[0048] By dynamically adjusting the splicing scale, the feature sparsity problem caused by uneven field lengths is reduced, improving the model's adaptability to multi-scale sensitive data. Finally, each cell consists of a token sequence: ,in One of the tokens representing the content of the cell;
[0049] The final result is:
[0050] .
[0051] Because the lengths of sensitive information in different fields vary significantly, this splicing method results in sensitive fields exhibiting multi-scale distribution characteristics.
[0052] The processed data will appear in the following form:
[0053] Estet Interior DOO||lincoln county government||Leavitt Area HighSchool||Town Health Corporate Advisory And Investments Limited||CologicaScientific;;;Organization.
[0054] S12, Data Cleaning.
[0055] It is foreseeable that a very small number of data points will end with content consistent with the delimiter format, ultimately causing the model to identify illegal types. This situation mainly affects the model's training process, leading to abnormal classifications. Cleaning up some boundary values can prevent this from happening.
[0056] S13, Character set encoding.
[0057] Specifically, it includes the following parts:
[0058] (1) Traverse the training dataset, count all the characters that have appeared, and construct a character-to-index mapping dictionary.
[0059] For example, char_dict = {' <pad> ':0, ' <unk>':1, 'E':2, 's':3, 't':4, ... ,';':128};
[0060] in <pad>Indicates the padding character (index 0). <unk>This indicates a character not logged in (index 1).
[0061] (2) Sequence indexing: Based on the mapping dictionary, each character in the text sequence is converted into its corresponding unique index. If the character is not in the dictionary, it is converted into... <unk>The corresponding indices form an initial index sequence:
[0062]
[0063] in, A character index sequence is a sequence formed by mapping each character in a text sequence to its corresponding unique index using a dictionary. This represents a character-to-index mapping function, used to convert a character into its corresponding index value in a dictionary. Represents a character in the sequence. Represents the original text sequence. This indicates the maximum sequence length.
[0064] For example: "Estet" → [2, 3, 4, 5, 6].
[0065] (3) Padding process: Determine whether the length of the initial index sequence is less than a preset maximum sequence length. If so, pad the end of the initial index sequence. <pad>The corresponding indexes are used until the sequence length equals the maximum sequence length to obtain the character index sequence.
[0066] S2, Feature Extraction and Fusion Step, which includes: inputting the character index sequence into an embedding layer to obtain a character embedding sequence, and then inputting the character embedding sequence into a bidirectional long short-term memory network to extract a temporal feature; establishing a first feature processing path, inputting the temporal feature into a self-attention mechanism module, and generating a global dependency feature by modeling the global dependency relationship between characters in the text sequence; establishing a second feature processing path parallel to the first feature processing path, which includes: performing feature extraction on the temporal feature using a multi-scale sliding window to obtain a multi-scale local feature; fusing the temporal feature and the multi-scale local feature through a gating mechanism to generate an intermediate feature; inputting the intermediate feature into a spatial attention module, and performing feature weighting on the intermediate feature to obtain a spatially enhanced feature; concatenating the global dependency feature and the spatially enhanced feature along the feature dimension to obtain a fused feature.
[0067] The specific process of step S2 is as follows:
[0068] S21. Input the character index sequence into an embedding layer to obtain a character embedding sequence, and then input the character embedding sequence into a bidirectional long short-term memory network to extract a temporal feature.
[0069] First, character indices are mapped to word vectors at the embedding layer.
[0070]
[0071] in This represents a character embedding sequence, where L is the sequence length and D is the embedding dimension. This represents a mapping. Where... For the embedding dimension, for example, 'E' → [0.12, -0.45, ..., 0.87]
[0072] Secondly, bidirectional Long Short-Term Memory (LSTM) networks capture sequence context dependencies:
[0073]
[0074] in The hidden layer dimension of the LSTM is [dimensional], and the output of each time step contains a feature vector concatenated from the forward and backward states. .
[0075] S22. Establish the first feature processing path, input the temporal features into a self-attention mechanism module, and generate a global dependency feature by modeling the global dependency relationship between characters in the text sequence.
[0076] Self-attention mechanisms model global dependencies between characters in a sequence, thus addressing the problem of sparse and scattered contextual information in structured data.
[0077] First, three projection matrices are input, and the temporal features output by the LSTM are... The projection consists of three sets of vectors: the query vector. key vector value vector .
[0078] in , , There are three projection matrices. For the projection dimension, it is generally set as follows: .
[0079] Secondly, attention weight calculation: positional relevance is calculated by scaling the dot product.
[0080]
[0081] in Indicates attention weights, This represents the activation function.
[0082] For example, in the sequence "Lincoln,county,government", the attention weight of "g" to "L" is 0.08, the weight of "g" to "county" is 0.25, and the weight of "g" to other characters in "government" is 0.67, thus enhancing the language strength at the word level.
[0083] Subsequently, feature enhancement: global information is aggregated using attention weights. .
[0084] For example, the final representation of the character 'g' is: ;
[0085] Finally, the weighted aggregated global dependency features are output. ,when The self-attention mechanism can be summarized by the following formula:
[0086]
[0087] When the input is "Town Health Corporate Advisory", the weight of "C" in "Corporate" and "Town" is 0.62, and the weight of "A" in "Advisory" and "Corporate" is 0.58, forming a semantic chain "Town-Health-Corporate-Advisory".
[0088] S23. Establish a second feature processing path parallel to the first feature processing path. This path includes:
[0089] (1) Multi-scale sliding window is used to extract features from temporal features to obtain multi-scale local features.
[0090] For input data Using sliding window scale set (e.g., {1, 3, 5}) Perform multi-scale sliding window (MSW) feature extraction.
[0091] First, single-scale sliding window feature extraction (for each scale) To maintain the same length as the input sequence (L), in The temporal dimension (L) is padded at both ends. The zero vectors are obtained Then for each time step (Corresponding to the original sequence position), calculate the weighted sum of features within the window:
[0092]
[0093] in For scale The window weight vector satisfies (Numerical stability). Single-scale results Consistent with the input dimension.
[0094] Secondly, multi-scale feature fusion: This involves combining results from all scales. Fusion into a final multi-scale sliding window output First, multi-scale features are concatenated to obtain multi-scale local features. :
[0095]
[0096] Where, K = | | represents the scale. Then, the concatenated features are compressed back to H dimensions through a linear transformation:
[0097]
[0098] in, It is a learnable projection matrix.
[0099] (2) A gating mechanism is used to fuse temporal features with multi-scale local features to generate an intermediate feature.
[0100] After multi-scale sliding window feature extraction, a cross-modal feature interaction module (CMI) is added to dynamically fuse LSTM temporal features and multi-scale sliding window features through a gating mechanism.
[0101] First, calculate the interaction weights:
[0102]
[0103] in For learnable parameters, σ is the bias value, and σ is the Sigmoid function.
[0104] Secondly, multimodal feature fusion:
[0105]
[0106] in Indicates intermediate features.
[0107] (3) Input the intermediate features into a spatial attention module, perform feature weighting on the intermediate features, and obtain a spatial enhancement feature.
[0108] The input will be fed into the subsequent spatial attention module, which uses a gating mechanism to balance the importance of temporal and local features, solves the feature conflict problem caused by traditional splicing, and improves the robustness of feature representation.
[0109] Spatial attention mechanism: This mechanism dynamically enhances the features of sensitive fields, solving the problem of scattered key information in structured data.
[0110] First, channel compression and feature aggregation are performed, along with average pooling and max pooling along the channel dimension:
[0111]
[0112]
[0113] in, This represents the output after average pooling. This represents the output after the max pooling operation. This indicates the average pooling operation. This indicates a max pooling operation.
[0114] For example, in the word "government", the feature value of the character 'g' is [0.2, 0.8...]. After average pooling, it becomes 0.5, and after max pooling, it becomes 0.8.
[0115] Secondly, the results of the two are concatenated to obtain the enhanced descriptor. .
[0116] For the character 'g', the concatenated feature vector becomes [0.5, 0.8].
[0117] Specifically, spatial dependencies are learned through the spatial attention mechanism (SAM):
[0118]
[0119] in This is an intermediate variable representing the original output after processing through the spatial attention mechanism. In the spatial attention mechanism, we use a two-dimensional convolutional kernel (...). The output is fixed as a single channel with a stride of 1, and specific characters are used for edge padding to keep the convolution result consistent with the original size. An attention mask is generated after activation using the Sigmoid function. .
[0120] Increase attention weight for key character regions; for example, in the word "government," the "gov" part has a weight of approximately 0.9. The separator "," has a weight of less than 0.1.
[0121] Feature weighting involves multiplying the input with the attention mask one by one to enhance key local features, resulting in spatially enhanced features. ,in This indicates element-wise multiplication.
[0122] S24. Concatenate the global dependency features and spatial enhancement features along the feature dimension to obtain a fused feature.
[0123] spatial enhancement features With global dependency features By concatenating the features along their respective dimensions, a fused feature is obtained that contains information from both sources. .
[0124] S3. Classification step: Input the fused features into the classifier to obtain the sensitive data category of the structured data.
[0125] The classification includes the following two steps:
[0126] First, perform global pooling compression ( Output dimension-invariant feature vectors .
[0127] Secondly, the probability distribution is output on a fully connected layer:
[0128]
[0129] Where N is the number of categories, and a specific natural number is used to index a specific category, such as ID number = 0, phone number = 1, address = 2, etc.
[0130] Example 2
[0131] Please see Figure 2 The diagram shown is a structural schematic of a structured sensitive data detection system with adaptive splicing scale proposed in the second embodiment of this application. The system includes the following key modules:
[0132] The data preprocessing module 100 is used to acquire structured data, concatenate multiple fields in the structured data into a text sequence using a preset delimiter, and encode the text sequence into a character set to obtain a character index sequence.
[0133] The feature extraction and fusion module 200 is used to input the character index sequence into an embedding layer to obtain a character embedding sequence, and then input the character embedding sequence into a bidirectional long short-term memory network to extract a temporal feature; establish a first feature processing path, input the temporal feature into a self-attention mechanism module, and generate a global dependency feature by modeling the global dependency relationship between characters in the text sequence; establish a second feature processing path parallel to the first feature processing path, which includes: extracting features from the temporal feature using a multi-scale sliding window to obtain a multi-scale local feature; fusing the temporal feature and the multi-scale local feature through a gating mechanism to generate an intermediate feature; inputting the intermediate feature into a spatial attention module to perform feature weighting on the intermediate feature to obtain a spatially enhanced feature; and concatenating the global dependency feature and the spatially enhanced feature along the feature dimension to obtain a fused feature.
[0134] The classification module 300 is used to input the fused features into the classifier to obtain the sensitive data categories of the structured data.
[0135] The structured sensitive data detection system with adaptive splicing scale in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), etc. This application embodiment does not specifically limit the specific implementation.
[0136] The structured sensitive data detection system with adaptive splicing scale in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.
[0137] The structured sensitive data detection system with adaptive splicing scale provided in this application embodiment can achieve... Figure 1 The various processes implemented in the method embodiment of the structured sensitive data detection method with adaptive splicing scale are not described in detail here to avoid repetition.
[0138] Optionally, embodiments of this application also provide an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the various processes of the above-described embodiment of a structured sensitive data detection method with adaptive splicing scale, and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0139] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described embodiment of a structured sensitive data detection method with adaptive splicing scale, and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0140] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0141] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0142] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0143] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.< / pad> < / unk> < / unk> < / pad> < / unk> < / pad> < / pad> < / unk> < / unk> < / pad>
Claims
1. A method for detecting structured sensitive data with adaptive splicing scale, characterized in that, The method includes: S1. Data preprocessing steps: Obtain structured data, concatenate multiple fields in the structured data into a text sequence using a preset delimiter, and encode the text sequence into a character index sequence; wherein, concatenating multiple fields in the structured data into a text sequence using a preset delimiter specifically includes: statistically analyzing the length distribution of each field based on the training dataset, and preset a concatenation scale threshold λ; for the field to be processed, determine its length; if the field length is greater than the threshold λ, then truncate the field according to the threshold λ length, and add a preset special mark at the end of each truncated segment; if the field length is less than the threshold λ, then loop through the character sequence of the field, and fill the end of the original field with the looped character sequence until the total length of the field reaches the threshold λ; S2. Feature Extraction and Fusion Steps: This step includes: The character index sequence is input into an embedding layer to obtain a character embedding sequence, and then the character embedding sequence is input into a bidirectional long short-term memory network to extract a temporal feature. A first feature processing path is established, and the temporal features are input into a self-attention mechanism module. By modeling the global dependencies between characters in the text sequence, a global dependency feature is generated. Specifically, the processing of the self-attention mechanism module includes: linearly transforming the input temporal features using a first projection matrix, a second projection matrix, and a third projection matrix to generate a query vector Q, a key vector K, and a value vector V; performing matrix multiplication on the transposes of the query vector Q and the key vector K, and scaling and normalizing the results using the Softmax function to calculate an attention weight matrix; and performing matrix multiplication between the attention weight matrix and the value vector V to obtain the weighted aggregated global dependency feature. Establish a second feature processing path parallel to the first feature processing path, which includes: The temporal features are extracted using a multi-scale sliding window to obtain multi-scale local features; An intermediate feature is generated by fusing the temporal features with the multi-scale local features through a gating mechanism. The intermediate features are input into a spatial attention module, and the intermediate features are weighted to obtain a spatially enhanced feature. The global dependency feature and the spatial enhancement feature are concatenated along the feature dimension to obtain a fused feature; S3. Classification step: Input the fused features into the classifier to obtain the sensitive data category of the structured data.
2. The structured sensitive data detection method with adaptive splicing scale according to claim 1, characterized in that, In the second feature processing path, a multi-scale sliding window is used to extract features from the temporal features to obtain multi-scale local features, specifically including: Preset a set of sliding window scales containing at least two distinct integers; For each scale s in the multi-scale sliding window scale set, s / 2 zero vectors are padded at both ends of the temporal dimension of the character embedding sequence to obtain a padded sequence; For each time step of the padded sequence, extract all feature vectors within a window centered at that time step and with a width of s, and calculate their weighted sum to obtain the single-scale sliding window feature at scale s. The single-scale sliding window features obtained at all scales are concatenated along the feature dimension, and then a linear transformation layer is used to compress the dimension of the concatenated features to be consistent with the hidden layer dimension of the temporal features, so as to obtain the multi-scale local features.
3. The structured sensitive data detection method with adaptive splicing scale according to claim 1, characterized in that, In the second feature processing path, a gating mechanism is used to fuse the temporal features with the multi-scale local features to generate an intermediate feature, specifically including: The temporal features are concatenated with the multi-scale local features or subjected to element-wise operations, and the result is input into a linear layer. Then, an interaction weight gate value is calculated by passing the Sigmoid activation function. ; Using the interaction weight gate value The time-series features are weighted, and 1- The multi-scale local features are weighted, and the two weighted results are added together to obtain the intermediate features.
4. The method for detecting structured sensitive data with adaptive splicing scale according to claim 1 or 3, characterized in that, In the second feature processing path, the spatial attention module's processing procedure specifically includes: Along the channel dimension of the intermediate feature, perform average pooling and max pooling operations respectively to obtain an average pooling feature descriptor and a max pooling feature descriptor. The average pooling feature descriptor and the max pooling feature descriptor are concatenated along the channel dimension to form an enhanced feature descriptor; The enhanced feature descriptor is input into a two-dimensional convolutional layer configured with a single output channel and zero padding for convolution operation. The convolution result is then processed by the Sigmoid activation function to generate a spatial attention mask. The spatial attention mask is multiplied element-wise with the input intermediate features to obtain the spatial enhancement features.
5. The structured sensitive data detection method with adaptive splicing scale according to claim 1, characterized in that, In the data preprocessing step, the text sequence is encoded using a character set to obtain a character index sequence, specifically including: Iterate through the training dataset, count all occurrences of characters, and construct a dictionary mapping characters to their indices, where... <pad>Indicates padding characters and uses <unk> Indicates a character indicating that the user is not logged in.< / unk> < / pad> Based on the mapping dictionary, each character in the text sequence is converted into its corresponding unique index. If a character is not in the dictionary, it is converted into... <unk> The corresponding indices form an initial index sequence;< / unk> Determine whether the length of the initial index sequence is less than a preset maximum sequence length. If so, pad the end of the initial index sequence with the specified length. <pad> The corresponding index is used until the sequence length equals the maximum sequence length to obtain the character index sequence.< / pad> 6. A structured sensitive data detection system with adaptive splicing scale, characterized in that, The system is used to implement the structured sensitive data detection method with adaptive splicing scale as described in claim 1, and the system includes: The data preprocessing module is used to acquire structured data, concatenate multiple fields in the structured data into a text sequence using a preset delimiter, and encode the text sequence into a character set to obtain a character index sequence. The feature extraction and fusion module is used to input the character index sequence into an embedding layer to obtain a character embedding sequence, and then input the character embedding sequence into a bidirectional long short-term memory network to extract a temporal feature; establish a first feature processing path, input the temporal feature into a self-attention mechanism module, and generate a global dependency feature by modeling the global dependencies between characters in the text sequence; establish a second feature processing path parallel to the first feature processing path, which includes: extracting features from the temporal feature using a multi-scale sliding window to obtain a multi-scale local feature; fusing the temporal feature and the multi-scale local feature through a gating mechanism to generate an intermediate feature; inputting the intermediate feature into a spatial attention module to perform feature weighting on the intermediate feature to obtain a spatially enhanced feature; and concatenating the global dependency feature and the spatially enhanced feature along the feature dimension to obtain a fused feature; The classification module is used to input the fused features into the classifier to obtain the sensitive data categories of the structured data.
7. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein when the program or instructions are executed by the processor, they implement the steps of the structured sensitive data detection method with adaptive splicing scale as described in any one of claims 1-5.
8. A readable storage medium, characterized in that, The program or instructions are stored on the readable storage medium, and when the program or instructions are executed by the processor, they implement the steps of the structured sensitive data detection method with adaptive splicing scale as described in any one of claims 1-5.
Citation Information
Patent Citations
Sensitive information detection method, device and equipment and readable storage medium
CN116932757A
Sensitive personal information identification method based on multi-scale feature dynamic fusion
CN118551048A