A mobile traffic classification method and system based on spatiotemporal hybrid representation learning
By employing a spatiotemporal hybrid representation learning method, the problems of spatiotemporal feature fragmentation and insufficient scale adaptation in mobile traffic classification are solved, achieving deep feature fusion and improving classification accuracy and generalization ability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-03-10
AI Technical Summary
Existing mobile traffic classification methods suffer from problems such as fragmented spatiotemporal features, insufficient scale adaptation, lack of feature interaction, and significant impact from differences in sample distribution, resulting in low classification accuracy and weak generalization ability.
We adopt a spatiotemporal hybrid representation learning approach. Through preprocessing of feature hierarchical selection and dynamic noise filtering, combined with attention-guided feature interaction, cross-scale feature alignment and temporal-spatial attention interaction mechanism, we optimize the quality of feature input and enhance spatiotemporal feature fusion to adapt to the differences in sample distribution of different traffic types.
It improves the accuracy and generalization ability of mobile traffic classification, achieves deep fusion of spatiotemporal features, and enhances classification accuracy.
Smart Images

Figure CN121211191B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic data processing and classification, and in particular to a mobile traffic classification method and system based on spatiotemporal hybrid representation learning. Background Technology
[0002] With the rapid development of the mobile internet, the types of mobile traffic (such as video streams, social application streams, and IoT device streams) are becoming increasingly complex. Therefore, accurate classification of mobile traffic has gradually become the core foundation for network management, service quality assurance, and security protection.
[0003] Existing technologies often suffer from three significant drawbacks in traditional methods: First, dual-path modeling fragments spatiotemporal features. Conventional LSTM and CNN only process single-dimensional features independently, failing to capture the nonlinear collaborative relationship between temporal and spatial features within a single time step (such as the instantaneous transmission pattern of "short arrival interval + small data packet length + one-way transmission"), resulting in insufficient fine-grained behavior characterization. Second, conventional CNNs can only extract spatial features at a fixed scale, failing to adapt to the scale differences in spatial features of different traffic types (such as the scale difference between large data packets in video streams and small packets in IoT streams). Furthermore, the ability of conventional LSTMs to capture long-term temporal dependencies is easily affected by gradient vanishing, making it difficult to uncover dynamic global patterns across time steps. Third, existing methods do not consider the impact of feature interaction, scale adaptation, and sample distribution differences on classification, lacking targeted components, resulting in weak generalization ability and low classification accuracy for complex traffic scenarios.
[0004] Therefore, designing a mobile traffic classification method to avoid the impact of existing technological shortcomings and improve the accuracy of mobile traffic classification has become an urgent problem to be solved. Summary of the Invention
[0005] Based on this, the present invention proposes a mobile traffic classification method and system based on spatiotemporal hybrid representation learning. Through a preprocessing mechanism of feature hierarchical screening and dynamic noise filtering, the quality of the original traffic feature input is optimized. Subsequently, attention-guided feature interaction is added in the micro-fusion stage to strengthen the nonlinear correlation of spatiotemporal features within a single time step. In the macro-fusion stage, a cross-scale feature alignment and temporal-spatial attention interaction mechanism is designed to avoid the limitations of traditional independent modeling. Finally, the classification module is optimized by combining a class adaptive loss adjustment strategy to adapt to the sample distribution differences of different traffic types. The present invention achieves deep fusion of spatiotemporal features and improves the accuracy of mobile traffic classification.
[0006] This invention proposes a mobile traffic classification method based on spatiotemporal hybrid representation learning, comprising:
[0007] Mobile traffic data is acquired and preprocessed to obtain a standardized traffic feature sequence. The preprocessing includes multi-dimensional feature processing, dynamic noise processing, and standardization processing.
[0008] The standardized traffic feature sequence is micro-fused according to the attention-guided cross-modal feature interaction algorithm to obtain an instantaneous feature matrix. The attention-guided cross-modal feature interaction algorithm is based on temporal class embedding vectors and spatial class embedding vectors. The instantaneous feature matrix is generated based on a bidirectional long short-term memory network.
[0009] The instantaneous feature matrix is subjected to macroscopic fusion processing based on a cross-scale spatial enhancement algorithm and a temporal-spatial attention interaction mechanism to obtain global fusion features. The cross-scale spatial enhancement algorithm is based on multi-scale feature weighted fusion, and the temporal-spatial attention interaction mechanism is based on temporal attention weights.
[0010] The classification is performed based on the global fusion features to obtain the final classification result, and the classification is based on category adaptive optimization.
[0011] In summary, based on the aforementioned mobile traffic classification method using spatiotemporal hybrid representation learning, this invention optimizes the quality of the original traffic feature input through a preprocessing mechanism of feature hierarchical screening and dynamic noise filtering. Subsequently, attention-guided feature interaction is added in the micro-fusion stage to strengthen the nonlinear correlation of spatiotemporal features within a single time step. Furthermore, a cross-scale feature alignment and temporal-spatial attention interaction mechanism is designed in the macro-fusion stage to avoid the limitations of traditional independent modeling. Finally, the classification module is optimized by combining a class adaptive loss adjustment strategy to adapt to the sample distribution differences of different traffic types. This invention achieves deep fusion of spatiotemporal features and improves the accuracy of mobile traffic classification. Specifically, the process involves acquiring and preprocessing mobile traffic data to obtain a standardized traffic feature sequence. This preprocessing includes multi-dimensional feature processing, dynamic noise reduction, and standardization, optimizing the quality of the original traffic feature input. The standardized traffic feature sequence is then subjected to micro-fusion processing using an attention-guided cross-modal feature interaction algorithm to obtain an instantaneous feature matrix. This algorithm is based on temporal and spatial embedding vectors, and the instantaneous feature matrix is generated using a bidirectional long short-term memory network, strengthening the nonlinear correlation of spatiotemporal features within a single time step. The instantaneous feature matrix is then subjected to macro-fusion processing using a cross-scale spatial enhancement algorithm and a temporal-spatial attention interaction mechanism to obtain global fusion features. This algorithm is based on multi-scale feature weighted fusion, and the temporal-spatial attention interaction mechanism is based on temporal attention weights, avoiding the limitations of traditional independent modeling. Finally, the global fusion features are used for classification to obtain the final classification result. This classification is based on adaptive category optimization, adapting to the differences in sample distribution for different traffic types. This invention achieves deep fusion of spatiotemporal features, improving the accuracy of mobile traffic classification.
[0012] Furthermore, the step of acquiring mobile traffic data and preprocessing it to obtain a standardized traffic feature sequence specifically includes:
[0013] Acquire mobile traffic data, and perform packet parsing on the mobile traffic data to obtain spatial and temporal features. The spatial features include packet length features and transmission direction features, and the temporal features include time interval features.
[0014] The spatial and temporal features are hierarchically filtered according to the feature importance hierarchy algorithm to obtain spatial feature sequences and temporal feature sequences. The feature importance hierarchy algorithm is based on the feature contribution evaluation of random forest.
[0015] The spatial and temporal feature sequences are subjected to noise detection using a sliding window, and noise correction is performed using a neighborhood mean replacement algorithm and a trend preservation algorithm to obtain denoised spatial and temporal feature sequences.
[0016] The denoised spatial and temporal feature sequences are subjected to length normalization, which includes information entropy truncation and linear interpolation. The information entropy truncation is used to extract key information segments from long sequences in the spatial and temporal feature sequences, and the linear interpolation is used to fill short sequences in the spatial and temporal feature sequences. The length-normalized spatial feature sequences are then normalized using the min-max normalization algorithm and one-hot encoding, and the length-normalized temporal feature sequences are then normalized using the Z-score normalization algorithm to obtain a normalized traffic feature sequence.
[0017] Furthermore, the step of performing micro-fusion processing on the standardized traffic feature sequence based on the attention-guided cross-modal feature interaction algorithm to obtain the instantaneous feature matrix specifically includes:
[0018] The standardized traffic feature sequence is tokenized and an embedding matrix is constructed to obtain a temporal embedding matrix and a spatial embedding matrix. Then, the temporal embedding matrix and the spatial embedding matrix are mapped in a high dimension to obtain a temporal embedding vector and a spatial embedding vector.
[0019] Cross-modal interaction operations are performed on the temporal and spatial embedding vectors to obtain interaction feature vectors. The cross-modal interaction operations include element-wise multiplication and element-wise addition. The element-wise multiplication is used to capture the correlation strength between temporal and spatial features, and the element-wise addition is used to capture the collaborative contribution of temporal and spatial features.
[0020] Then, the interaction feature weights are calculated based on the interaction attention mechanism. The specific algorithm for calculating the interaction feature weights is as follows:
[0021] ,
[0022] in, Represents the interaction feature weights. and This represents the learnable parameters of interactive attention. Represents the interaction feature vector. This indicates that the feature sequence has a fixed length. The components representing the interactive feature vector, k Indicates the ordinal number of the component;
[0023] The interaction feature vector is weighted and enhanced according to the interaction feature weights to obtain the interaction enhancement embedding vector.
[0024] The interaction-enhanced embedding vector is modeled temporally based on a bidirectional long short-term memory network to obtain an instantaneous feature matrix.
[0025] Furthermore, the step of performing temporal dependency modeling on the interaction-enhanced embedding vector based on a bidirectional long short-term memory network to obtain an instantaneous feature matrix specifically includes:
[0026] The interaction-enhanced embedding vector is modeled using a bidirectional long short-term memory network to model temporal dependencies. Intra-sequence correlation information is captured from both forward and backward directions to output the hidden state at each time step. Then, a cross-modal attention mechanism is used to dynamically learn the temporal and spatial modalities to obtain the contribution weights of temporal and spatial features. The hidden states are then weighted and summed based on these weights to obtain instantaneous spatiotemporal hybrid features. The specific algorithm for obtaining these instantaneous spatiotemporal hybrid features is as follows:
[0027] ,
[0028] in, Indicates instantaneous spatiotemporal mixing characteristics. and These represent the contribution weights of time-related features and spatial features, respectively. and These represent the hidden states of temporal and spatial features, respectively.
[0029] Iterate through all time steps to obtain the instantaneous feature matrix of the complete sequence.
[0030] Furthermore, the step of performing macroscopic fusion processing on the instantaneous feature matrix based on the cross-scale spatial enhancement algorithm and the temporal-spatial attention interaction mechanism to obtain global fused features specifically includes:
[0031] A cross-scale spatial augmentation algorithm is used to enhance the spatial features of the instantaneous feature matrix to obtain augmented spatial features. This algorithm is based on a cross-scale CNN unit, which includes multiple 1D convolutional kernels of different scales. The cross-scale CNN unit captures local fine-grained, medium-scale, and global coarse-grained correlations of spatial features to obtain multi-scale features. These multi-scale features are then weighted and fused using a cross-scale feature alignment algorithm to obtain multi-scale weighted fused features. The cross-scale feature alignment algorithm dynamically learns adaptive weights for the multi-scale features through fully connected layers. The specific algorithm for obtaining the multi-scale weighted fused features is as follows:
[0032] ,
[0033] in, This represents the multi-scale weighted fusion feature. , , These represent the adaptive weights at the local fine-grained, medium-grained, and global coarse-grained levels, respectively. , , These represent multi-scale features at local fine-grained, medium-scale, and global coarse-grained levels, respectively.
[0034] The multi-scale weighted fusion features are enhanced using a channel attention mechanism to obtain the final spatially enhanced features.
[0035] Long-term temporal dependency modeling is performed on the final spatial augmentation feature using a bidirectional long short-term memory network to obtain a temporary hidden state. The final spatial augmentation feature is then dimension-adjusted through a fully connected layer to ensure consistency between the dimensions of the final spatial augmentation feature and the temporary hidden state. The cosine similarity between the dimension-adjusted final spatial augmentation feature and the temporary hidden state is calculated, and temporal attention weights are calculated based on the cosine similarity to obtain the temporal attention weights. The specific algorithm for obtaining the temporal attention weights is as follows:
[0036] ,
[0037] in, Indicates time attention weights. Represents the total cosine similarity. The cosine similarity of the components is represented by... and These represent the learnable parameters of temporal attention. Indicates a temporary hidden state. This indicates the temporary hidden state of the component. This indicates that the feature sequence has a fixed length. k Indicates the ordinal number of the component;
[0038] The temporary hidden states are weighted and summed according to the temporal attention weights to obtain temporal enhancement features;
[0039] The final spatial enhancement features and temporal enhancement features are adaptively fused globally to obtain global fused features.
[0040] Furthermore, the step of adaptively global fusing the final spatial enhancement features and temporal enhancement features to obtain global fused features specifically includes:
[0041] The final spatial and temporal augmentation features are concatenated dimensionally to obtain spatiotemporal concatenated features. Then, a fully connected layer is used to calculate the dynamic weights of the spatiotemporal concatenated features based on the contribution of each dimension to the classification task. The spatiotemporal concatenated features are weighted according to these dynamic weights to obtain global spatiotemporal hybrid features. The specific algorithm for obtaining global spatiotemporal hybrid features is as follows:
[0042] ,
[0043] in, Represents global spatiotemporal hybrid features. Indicates spatiotemporal splicing features, Represents the dynamic weights of the dimensions. Represents the ordinal number of the dimension. Represents the total dimension. express Spatiotemporal splicing features under different dimensions;
[0044] The global spatiotemporal hybrid features are subjected to L2 normalization to obtain global fusion features.
[0045] Furthermore, the step of classifying based on the global fusion features to obtain the final classification result specifically includes:
[0046] The globally fused features are input into the fully connected layer and mapped to a logits vector through a linear transformation. The logits vector is matched with the number of traffic categories. The layer is iteratively updated according to a dynamic category weight update mechanism. The specific algorithm for the dynamic category weight is as follows:
[0047] ,
[0048] in, Represents dynamic class weights. Represents the normalization coefficient. This represents the misclassification rate of the class samples. Indicates the number of samples;
[0049] The input weights of the Softmax function are adjusted based on the dynamic class weights, and the class probability distribution is optimized to obtain the predicted probability. The specific algorithm for obtaining the predicted probability is as follows:
[0050]
[0051] in, Indicates the predicted probability. Represents dynamic class weights. Represents the logits vector. Indicates the total number of categories. Indicates the ordinal number of the component. Represents the dynamic class weights of the components. The logits vector representing the components;
[0052] Then, based on the category-adaptive cross-entropy loss, the loss weights of category samples with high misclassification rates are increased to obtain the final classification result.
[0053] This invention proposes a mobile traffic classification system based on spatiotemporal hybrid representation learning, comprising:
[0054] The preprocessing module is used to acquire mobile traffic data and perform preprocessing to obtain a standardized traffic feature sequence. The preprocessing includes multi-dimensional feature processing, dynamic noise processing, and standardization processing.
[0055] The micro-fusion module is used to perform micro-fusion processing on the standardized traffic feature sequence according to the attention-guided cross-modal feature interaction algorithm to obtain an instantaneous feature matrix. The attention-guided cross-modal feature interaction algorithm is based on temporal class embedding vectors and spatial class embedding vectors, and the instantaneous feature matrix is generated based on a bidirectional long short-term memory network.
[0056] The macro-fusion module is used to perform macro-fusion processing on the instantaneous feature matrix according to the cross-scale spatial enhancement algorithm and the temporal-spatial attention interaction mechanism to obtain global fusion features. The cross-scale spatial enhancement algorithm is based on multi-scale feature weighted fusion, and the temporal-spatial attention interaction mechanism is based on temporal attention weights.
[0057] A classification module is used to classify based on the global fusion features to obtain a final classification result, wherein the classification is based on category adaptive optimization.
[0058] The present invention also provides a storage medium that stores one or more programs, which, when executed by a processor, implement the mobile traffic classification method based on spatiotemporal hybrid representation learning as described above.
[0059] The present invention also provides a computer device, the computer device including a memory and a processor, wherein:
[0060] The memory is used to store computer programs;
[0061] When the processor executes the computer program stored in the memory, it implements the mobile traffic classification method based on spatiotemporal hybrid representation learning as described above. Attached Figure Description
[0062] Figure 1 This is a flowchart of the mobile traffic classification method based on spatiotemporal hybrid representation learning proposed in the first embodiment of the present invention;
[0063] Figure 2 This is a schematic diagram of the structure of the mobile traffic classification system based on spatiotemporal hybrid representation learning proposed in the second embodiment of the present invention.
[0064] The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation
[0065] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
[0066] It should be noted that when a component is said to be "fixed to" another component, it can be directly on the other component or there may be an intervening component. When a component is said to be "connected to" another component, it can be directly connected to the other component or there may be an intervening component. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.
[0067] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0068] Please see Figure 1 The diagram shows a flowchart of the mobile traffic classification method based on spatiotemporal hybrid representation learning proposed in the first embodiment of the present invention. This mobile traffic classification method based on spatiotemporal hybrid representation learning includes steps S01 to S04, wherein:
[0069] Step S01: Acquire mobile traffic data and preprocess it to obtain a standardized traffic feature sequence;
[0070] It should be noted that in this embodiment, the preprocessing includes multi-dimensional feature processing, dynamic noise processing and standardization processing to obtain mobile traffic data, and to perform packet parsing on the mobile traffic data to obtain spatial features and temporal features. The spatial features include packet length features and transmission direction features, and the temporal features include time interval features.
[0071] The spatial and temporal features are hierarchically filtered according to the feature importance hierarchy algorithm to obtain spatial feature sequences and temporal feature sequences. The feature importance hierarchy algorithm is based on the feature contribution evaluation of random forest.
[0072] The spatial and temporal feature sequences are subjected to noise detection using a sliding window, and noise correction is performed using a neighborhood mean replacement algorithm and a trend preservation algorithm to obtain denoised spatial and temporal feature sequences.
[0073] The denoised spatial and temporal feature sequences are subjected to length normalization, which includes information entropy truncation and linear interpolation. The information entropy truncation is used to extract key information segments from long sequences in the spatial and temporal feature sequences, and the linear interpolation is used to fill short sequences in the spatial and temporal feature sequences. The length-normalized spatial feature sequences are then normalized using the min-max normalization algorithm and one-hot encoding, and the length-normalized temporal feature sequences are then normalized using the Z-score normalization algorithm to obtain a normalized traffic feature sequence.
[0074] Step S02: Perform micro-fusion processing on the standardized traffic feature sequence according to the attention-guided cross-modal feature interaction algorithm to obtain the instantaneous feature matrix;
[0075] It should be noted that in this embodiment, the attention-guided cross-modal feature interaction algorithm is based on temporal embedding vectors and spatial embedding vectors. The instantaneous feature matrix is generated based on a bidirectional long short-term memory network. The standardized traffic feature sequence is tokenized and an embedding matrix is constructed to obtain the temporal embedding matrix and the spatial embedding matrix. Then, the temporal embedding matrix and the spatial embedding matrix are mapped in a high dimension to obtain the temporal embedding vector and the spatial embedding vector.
[0076] Cross-modal interaction operations are performed on the temporal and spatial embedding vectors to obtain interaction feature vectors. The cross-modal interaction operations include element-wise multiplication and element-wise addition. The element-wise multiplication is used to capture the correlation strength between temporal and spatial features, and the element-wise addition is used to capture the collaborative contribution of temporal and spatial features.
[0077] Then, the interaction feature weights are calculated based on the interaction attention mechanism. The specific algorithm for calculating the interaction feature weights is as follows:
[0078] ,
[0079] in, Represents the interaction feature weights. and This represents the learnable parameters of interactive attention. Represents the interaction feature vector. This indicates that the feature sequence has a fixed length. The components representing the interactive feature vector, k Indicates the ordinal number of the component;
[0080] The interaction feature vector is weighted and enhanced according to the interaction feature weights to obtain the interaction enhancement embedding vector.
[0081] The interaction-enhanced embedding vector is modeled according to a bidirectional long short-term memory network to obtain an instantaneous feature matrix;
[0082] The interaction-enhanced embedding vector is modeled using a bidirectional long short-term memory network to model temporal dependencies. Intra-sequence correlation information is captured from both forward and backward directions to output the hidden state at each time step. Then, a cross-modal attention mechanism is used to dynamically learn the temporal and spatial modalities to obtain the contribution weights of temporal and spatial features. The hidden states are then weighted and summed based on these weights to obtain instantaneous spatiotemporal hybrid features. The specific algorithm for obtaining these instantaneous spatiotemporal hybrid features is as follows:
[0083] ,
[0084] in, Indicates instantaneous spatiotemporal mixing characteristics. and These represent the contribution weights of time-related features and spatial features, respectively. and These represent the hidden states of temporal and spatial features, respectively.
[0085] Iterate through all time steps to obtain the instantaneous feature matrix of the complete sequence.
[0086] Step S03: Perform macroscopic fusion processing on the instantaneous feature matrix based on the cross-scale spatial enhancement algorithm and the temporal-spatial attention interaction mechanism to obtain global fusion features;
[0087] It should be noted that in this embodiment, the cross-scale spatial enhancement algorithm is based on multi-scale feature weighted fusion, and the temporal-spatial attention interaction mechanism is based on temporal attention weights. The instantaneous feature matrix is subjected to spatial feature enhancement processing according to the cross-scale spatial enhancement algorithm to obtain spatially enhanced features. The cross-scale spatial enhancement algorithm is based on a cross-scale CNN unit, which includes multiple 1D convolutional kernels of different scales. The cross-scale CNN unit captures local fine-grained, medium-scale, and global coarse-grained correlations of spatial features to obtain multi-scale features. The multi-scale features are weighted and fused according to a cross-scale feature alignment algorithm to obtain multi-scale weighted fused features. The cross-scale feature alignment algorithm dynamically learns adaptive weights for multi-scale features through fully connected layers. The specific algorithm for obtaining multi-scale weighted fused features is as follows:
[0088] ,
[0089] in, This represents the multi-scale weighted fusion feature. , , These represent the adaptive weights at the local fine-grained, medium-grained, and global coarse-grained levels, respectively. , , These represent multi-scale features at local fine-grained, medium-scale, and global coarse-grained levels, respectively.
[0090] The multi-scale weighted fusion features are enhanced using a channel attention mechanism to obtain the final spatially enhanced features.
[0091] Long-term temporal dependency modeling is performed on the final spatial augmentation feature using a bidirectional long short-term memory network to obtain a temporary hidden state. The final spatial augmentation feature is then dimension-adjusted through a fully connected layer to ensure consistency between the dimensions of the final spatial augmentation feature and the temporary hidden state. The cosine similarity between the dimension-adjusted final spatial augmentation feature and the temporary hidden state is calculated, and temporal attention weights are calculated based on the cosine similarity to obtain the temporal attention weights. The specific algorithm for obtaining the temporal attention weights is as follows:
[0092] ,
[0093] in, Indicates time attention weights. Represents the total cosine similarity. The cosine similarity of the components is represented by... and These represent the learnable parameters of temporal attention. Indicates a temporary hidden state. This indicates the temporary hidden state of the component. This indicates that the feature sequence has a fixed length. k Indicates the ordinal number of the component;
[0094] The temporary hidden states are weighted and summed according to the temporal attention weights to obtain temporal enhancement features;
[0095] Adaptive global fusion is performed on the final spatial enhancement features and temporal enhancement features to obtain global fused features;
[0096] The final spatial and temporal augmentation features are concatenated dimensionally to obtain spatiotemporal concatenated features. Then, a fully connected layer is used to calculate the dynamic weights of the spatiotemporal concatenated features based on the contribution of each dimension to the classification task. The spatiotemporal concatenated features are weighted according to these dynamic weights to obtain global spatiotemporal hybrid features. The specific algorithm for obtaining global spatiotemporal hybrid features is as follows:
[0097] ,
[0098] in, Represents global spatiotemporal hybrid features. Indicates spatiotemporal splicing features, Represents the dynamic weights of the dimensions. Represents the ordinal number of the dimension. Represents the total dimension. express Spatiotemporal splicing features under different dimensions;
[0099] The global spatiotemporal hybrid features are subjected to L2 normalization to obtain global fusion features.
[0100] Step S04: Classify based on global fusion features to obtain the final classification result;
[0101] It should be noted that in this embodiment, the classification is based on category adaptive optimization. The globally fused features are input into the fully connected layer and mapped to a logits vector through a linear transformation. The logits vector is matched with the number of traffic categories. The classification is iterated according to a dynamic category weight update mechanism. The specific algorithm for the dynamic category weight is as follows:
[0102] ,
[0103] in, Represents dynamic class weights. Represents the normalization coefficient. This represents the misclassification rate of the class samples. Indicates the number of samples;
[0104] The input weights of the Softmax function are adjusted based on the dynamic class weights, and the class probability distribution is optimized to obtain the predicted probability. The specific algorithm for obtaining the predicted probability is as follows:
[0105]
[0106] in, Indicates the predicted probability. Represents dynamic class weights. Represents the logits vector. Indicates the total number of categories. Indicates the ordinal number of the component. Represents the dynamic class weights of the components. The logits vector representing the components;
[0107] Then, based on the category-adaptive cross-entropy loss, the loss weights of category samples with high misclassification rates are increased to obtain the final classification result.
[0108] In summary, based on the aforementioned mobile traffic classification method using spatiotemporal hybrid representation learning, this invention optimizes the quality of the original traffic feature input through a preprocessing mechanism of feature hierarchical screening and dynamic noise filtering. Subsequently, attention-guided feature interaction is added in the micro-fusion stage to strengthen the nonlinear correlation of spatiotemporal features within a single time step. Furthermore, a cross-scale feature alignment and temporal-spatial attention interaction mechanism is designed in the macro-fusion stage to avoid the limitations of traditional independent modeling. Finally, the classification module is optimized by combining a class adaptive loss adjustment strategy to adapt to the sample distribution differences of different traffic types. This invention achieves deep fusion of spatiotemporal features and improves the accuracy of mobile traffic classification. Specifically, the process involves acquiring and preprocessing mobile traffic data to obtain a standardized traffic feature sequence. This preprocessing includes multi-dimensional feature processing, dynamic noise reduction, and standardization, optimizing the quality of the original traffic feature input. The standardized traffic feature sequence is then subjected to micro-fusion processing using an attention-guided cross-modal feature interaction algorithm to obtain an instantaneous feature matrix. This algorithm is based on temporal and spatial embedding vectors, and the instantaneous feature matrix is generated using a bidirectional long short-term memory network, strengthening the nonlinear correlation of spatiotemporal features within a single time step. The instantaneous feature matrix is then subjected to macro-fusion processing using a cross-scale spatial enhancement algorithm and a temporal-spatial attention interaction mechanism to obtain global fusion features. This algorithm is based on multi-scale feature weighted fusion, and the temporal-spatial attention interaction mechanism is based on temporal attention weights, avoiding the limitations of traditional independent modeling. Finally, the global fusion features are used for classification to obtain the final classification result. This classification is based on adaptive category optimization, adapting to the differences in sample distribution for different traffic types. This invention achieves deep fusion of spatiotemporal features, improving the accuracy of mobile traffic classification.
[0109] Please see Figure 2 The diagram shows a schematic of a mobile traffic classification system based on spatiotemporal hybrid representation learning proposed in the second embodiment of the present invention. The system includes:
[0110] Preprocessing module 10 is used to acquire mobile traffic data and perform preprocessing to obtain a standardized traffic feature sequence. The preprocessing includes multi-dimensional feature processing, dynamic noise processing and standardization processing.
[0111] The micro-fusion module 20 is used to perform micro-fusion processing on the standardized traffic feature sequence according to the attention-guided cross-modal feature interaction algorithm to obtain an instantaneous feature matrix. The attention-guided cross-modal feature interaction algorithm is based on temporal class embedding vectors and spatial class embedding vectors, and the instantaneous feature matrix is generated based on a bidirectional long short-term memory network.
[0112] The macro-fusion module 30 is used to perform macro-fusion processing on the instantaneous feature matrix according to the cross-scale spatial enhancement algorithm and the temporal-spatial attention interaction mechanism to obtain global fusion features. The cross-scale spatial enhancement algorithm is based on multi-scale feature weighted fusion, and the temporal-spatial attention interaction mechanism is based on temporal attention weight.
[0113] The classification module 40 is used to classify based on the global fusion features to obtain a final classification result, wherein the classification is based on category adaptive optimization.
[0114] The present invention also proposes a computer storage medium storing one or more programs that, when executed by a processor, implement the above-described mobile traffic classification method based on spatiotemporal hybrid representation learning.
[0115] The present invention also proposes a computer device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to implement the above-mentioned mobile traffic classification method based on spatiotemporal hybrid representation learning.
[0116] Those skilled in the art will understand that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can mean any means that can contain stored, communicated, propagated, or transmitted programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0117] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0118] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0119] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0120] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A mobile traffic classification method based on spatio-temporal hybrid representation learning, characterized in that, The method comprises the steps of: acquiring mobile traffic data and preprocessing to obtain a standardized traffic feature sequence, the preprocessing including multidimensional feature processing, dynamic noise processing and standardization processing; microscopic fusion processing of the standardized traffic feature sequence according to an attention-guided cross-modal feature interaction algorithm to obtain an instantaneous feature matrix, the attention-guided cross-modal feature interaction algorithm being based on time class embedding vectors and space class embedding vectors, and the instantaneous feature matrix being generated based on a bidirectional long short-term memory network; the step of microscopic fusion processing of the standardized traffic feature sequence according to the attention-guided cross-modal feature interaction algorithm to obtain an instantaneous feature matrix specifically comprises: tokenization processing of the standardized traffic feature sequence and construction of an embedding matrix to obtain time class embedding matrices and space class embedding matrices, and high-dimensional mapping of the time class embedding matrices and the space class embedding matrices to obtain time class embedding vectors and space class embedding vectors; cross-modal interaction operation of the time class embedding vectors and the space class embedding vectors to obtain an interaction feature vector, the cross-modal interaction operation including element-level multiplication and element-level addition, the element-level multiplication being used to capture the correlation strength of time features and space features, and the element-level addition being used to capture the synergistic contribution of time features and space features; interaction feature weight calculation according to an interaction attention mechanism, the specific algorithm for calculating the interaction feature weight being as follows: , wherein, denotes an interaction feature weight, and denotes an interaction attention learnable parameter, denotes an interaction feature vector, denotes a fixed length of a feature sequence, denotes a component of an interaction feature vector, k denotes a component ordinal; weighted enhancement of the interaction feature vector according to the interaction feature weight to obtain an interaction-enhanced embedding vector; time sequence dependence modeling of the interaction-enhanced embedding vector according to a bidirectional long short-term memory network to obtain an instantaneous feature matrix; macroscopic fusion processing of the instantaneous feature matrix according to a cross-scale space enhancement algorithm and a time-space attention interaction mechanism to obtain a global fusion feature, the cross-scale space enhancement algorithm being based on multi-scale feature weighted fusion, and the time-space attention interaction mechanism being based on time attention weight; classification according to the global fusion feature to obtain a final classification result, the classification being based on class adaptive optimization.
2. The method of claim 1, wherein the method is based on spatio-temporal hybrid representation learning. The step of acquiring mobile traffic data and preprocessing to obtain a standardized traffic feature sequence specifically comprises: acquiring mobile traffic data, packet analysis of the mobile traffic data to obtain space features and time features, the space features including packet length features and transmission direction features, and the time features including time interval features; layered screening of the space features and the time features according to a feature importance layering algorithm to obtain space class feature sequences and time class feature sequences, the feature importance layering algorithm being based on random forest feature contribution degree evaluation; noise detection of the space class feature sequences and the time class feature sequences according to a sliding window, and noise correction processing according to a neighborhood mean replacement algorithm and a trend preservation algorithm to obtain denoised space class feature sequences and time class feature sequences; The length normalized spatial feature sequence and the length normalized time feature sequence are subjected to information entropy truncation processing and linear interpolation processing, the information entropy truncation processing is used for key information segment interception of long sequences in the spatial feature sequence and the time feature sequence, and the linear interpolation processing is used for filling of short sequences in the spatial feature sequence and the time feature sequence; the length normalized spatial feature sequence is subjected to standardization processing according to a min-max standardization algorithm and one-hot encoding; and the length normalized time feature sequence is subjected to standardization processing according to a Z-score standardization algorithm, so as to obtain a standardized flow feature sequence. 3.The method of claim 1, wherein, The step of performing time sequence dependence modeling on the interaction enhanced embedding vector according to the bidirectional long short-term memory network to obtain an instantaneous feature matrix specifically includes: The bidirectional long short-term memory network is used to perform time sequence dependence modeling on the interaction enhanced embedding vector, to capture intra-sequence correlation information from the forward direction and the reverse direction respectively, to output a hidden state of each time step, and a cross-modal attention mechanism is used to dynamically learn the time mode and the space mode, to obtain a time feature contribution degree weight and a space feature contribution degree weight, and the hidden state is weighted and summed according to the time feature contribution degree weight and the space feature contribution degree weight, to obtain an instantaneous space-time hybrid feature, and the specific algorithm for obtaining the instantaneous space-time hybrid feature is as follows: , wherein, represents the instantaneous spatio-temporal mixing feature, and respectively represent the time class feature contribution weight and the space class feature contribution weight, and respectively represent the hidden state of the time class feature and the hidden state of the space class feature. All time steps are traversed to obtain an instantaneous feature matrix of a complete sequence. 4.The method of claim 1, wherein, The step of performing macroscopic fusion processing on the instantaneous feature matrix according to a cross-scale space enhancement algorithm and a time-space attention interaction mechanism to obtain a global fusion feature specifically includes: The cross-scale space enhancement algorithm is used to perform spatial feature enhancement processing on the instantaneous feature matrix to obtain a spatial enhancement feature, the cross-scale space enhancement algorithm is based on a cross-scale CNN unit, the cross-scale CNN unit includes a plurality of 1D convolution kernels of different scales, the cross-scale CNN unit captures local fine-grained, medium-scale and global coarse-grained correlations of spatial features respectively to obtain multi-scale features, and a cross-scale feature alignment algorithm is used to weight and fuse the multi-scale features to obtain a multi-scale weighted fusion feature, the cross-scale feature alignment algorithm dynamically learns adaptive weights of the multi-scale features through a fully connected layer, and the specific algorithm for obtaining the multi-scale weighted fusion feature is as follows: , wherein, denotes a multi-scale weighted fusion feature, , , denote adaptive weights of local fine-grained, medium-scale, and global coarse-grained, respectively, , , denote multi-scale features of local fine-grained, medium-scale, and global coarse-grained, respectively. The multi-scale weighted fusion feature is subjected to channel enhancement according to a channel attention mechanism to obtain a final spatial enhancement feature; The bidirectional long short-term memory network is used to perform long-range time sequence dependence modeling on the final spatial enhancement feature to obtain a temporary hidden state, the final spatial enhancement feature is subjected to dimension adjustment through a fully connected layer, the dimension adjustment is used to adjust the dimension of the final spatial enhancement feature to be consistent with the dimension of the temporary hidden state, a cosine similarity between the final spatial enhancement feature after the dimension adjustment and the temporary hidden state is calculated, and a time attention weight is calculated according to the cosine similarity to obtain a time attention weight, and the specific algorithm for obtaining the time attention weight is as follows: , wherein, denotes the temporal attention weight, denotes the total cosine similarity, denotes the cosine similarity of a component, and denote the temporal attention learnable parameters, denotes the temporary hidden state, denotes the temporary hidden state of a component, denotes the fixed length of a feature sequence, k denotes the component ordinal number; weighting and summing the temporary hidden states according to the time attention weights to obtain time enhanced features; adaptively globally fusing the final spatial enhanced features and the time enhanced features to obtain global fusion features.
5. The method of claim 4, wherein the spatio-temporal hybrid representation learning based mobile traffic classification is characterized by, The step of adaptively globally fusing the final spatial enhanced features and the time enhanced features to obtain global fusion features specifically includes: concatenating the final spatial enhanced features and the time enhanced features by dimensions to obtain spatio-temporal concatenated features, and then calculating dimension dynamic weights of the spatio-temporal concatenated features through a fully connected layer, wherein the dimension dynamic weights are based on the contribution of each dimension to the classification task, and the spatio-temporal concatenated features are weighted processed according to the dimension dynamic weights to obtain global spatio-temporal mixed features, and the specific algorithm for obtaining the global spatio-temporal mixed features is as follows: , wherein, represents global spatio-temporal hybrid features, represents spatio-temporal concatenation features, represents dimension dynamic weights, represents dimension ordinal, represents total dimensions, represents spatio-temporal concatenation features under the dimension; performing L2 normalization processing on the global spatio-temporal mixed features to obtain global fusion features. 6.The method of claim 1, wherein, The step of classifying according to the global fusion features to obtain a final classification result specifically includes: inputting the global fusion features into a fully connected layer and mapping to a logits vector through linear transformation, wherein the logits vector matches the number of traffic categories, and iteratively updating the dynamic category weight according to a dynamic category weight updating mechanism, and the specific algorithm of the dynamic category weight is as follows: , wherein, denotes a dynamic class weight, denotes a normalization coefficient, denotes a misclassification rate of a class sample, denotes a number of samples; adjusting the input weight of the Softmax function according to the dynamic category weight, and optimizing the category probability distribution to obtain a prediction probability, and the specific algorithm for obtaining the prediction probability is as follows: wherein, denotes a predicted probability, denotes a dynamic class weight, denotes a logits vector, denotes a total number of classes, denotes a component ordinal number, denotes a dynamic class weight of a component, denotes a logits vector of a component; increasing the loss weight of the high misclassification rate category sample in the category sample according to the category adaptive cross-entropy loss to obtain a final classification result.
7. A mobile traffic classification system based on spatio-temporal hybrid representation learning, characterized in that, It includes: a preprocessing module for obtaining mobile traffic data and preprocessing to obtain standardized traffic feature sequences, wherein the preprocessing includes multi-dimensional feature processing, dynamic noise processing and standardization processing; a microscopic fusion module for performing microscopic fusion processing on the standardized traffic feature sequences according to an attention-guided cross-modal feature interaction algorithm to obtain an instantaneous feature matrix, wherein the attention-guided cross-modal feature interaction algorithm is based on a time category embedding vector and a space category embedding vector, and the instantaneous feature matrix is generated based on a bidirectional long short-term memory network; tokenizing the standardized traffic feature sequences and constructing an embedding matrix to obtain a time category embedding matrix and a space category embedding matrix, and then performing high-dimensional mapping on the time category embedding matrix and the space category embedding matrix to obtain a time category embedding vector and a space category embedding vector; performing cross-modal interaction operation on the time category embedding vector and the space category embedding vector to obtain an interaction feature vector, wherein the cross-modal interaction operation includes element-level multiplication and element-level addition, the element-level multiplication is used to capture the correlation strength of time features and space features, and the element-level addition is used to capture the synergistic contribution of time features and space features; calculating interaction feature weights according to an interaction attention mechanism, and the specific algorithm for calculating the interaction feature weights is as follows: , wherein, denotes an interaction feature weight, and denotes an interaction attention learnable parameter, denotes an interaction feature vector, denotes a fixed length of a feature sequence, denotes a component of the interaction feature vector, k denotes a component ordinal; weighting and enhancing the interaction feature vector according to the interaction feature weights to obtain an interaction enhanced embedding vector; The bidirectional long short-term memory network is used for time sequence dependence modeling on the interaction enhanced embedding vector to obtain a transient feature matrix; The macroscopic fusion module is configured to perform macroscopic fusion processing on the transient feature matrix according to a cross-scale space enhancement algorithm and a time sequence-space attention interaction mechanism to obtain global fusion features, the cross-scale space enhancement algorithm is based on multi-scale feature weighted fusion, and the time sequence-space attention interaction mechanism is based on time attention weight; The classification module is configured to perform classification according to the global fusion features to obtain a final classification result, and the classification is based on category adaptive optimization.
8. A storage medium, characterized by The storage medium stores one or more programs, and the programs are executed by the processor to implement the mobile traffic classification method based on the spatio-temporal hybrid representation learning according to any one of claims 1-6.
9. A computer device, comprising: The computer device includes a memory and a processor, wherein: The memory is used to store a computer program; The processor is used to execute the computer program stored on the memory to implement the mobile traffic classification method based on the spatio-temporal hybrid representation learning according to any one of claims 1-6.
Citation Information
Patent Citations
Network traffic classification method based on attention mechanism
CN114818867A
Encrypted malicious traffic detection method based on multi-scale space-time interaction graph network
CN119583154A