A TSN traffic prediction method and system based on spatiotemporal feature fusion
By constructing a TSN traffic prediction model that fuses spatiotemporal features and learning time features at different granularities, the problem of insufficient TSN traffic prediction performance in existing technologies is solved, enabling more efficient network management and traffic prediction, and improving the real-time performance and reliability of the network.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 深圳市三旺通信股份有限公司
- Filing Date
- 2025-02-20
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies struggle to effectively learn time characteristics at different granularities, resulting in insufficient TSN traffic prediction performance and an inability to meet the high real-time and high reliability requirements of industrial networks.
A TSN traffic prediction method based on spatiotemporal feature fusion is adopted. By constructing a spatiotemporal fusion module, a coarse-grained time module, and a fine-grained time module, and combining a multi-head attention mechanism and dilated convolution, the method learns time features of different dimensions, and optimizes the model training through a loss function to build a prediction model.
It significantly improves the accuracy of TSN traffic prediction and the level of network management intelligence, optimizes traffic configuration and bandwidth allocation, avoids network congestion, and improves network efficiency and stability.
Smart Images

Figure CN120017531B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of network traffic prediction, specifically relating to a TSN traffic prediction method and system based on spatiotemporal feature fusion. Background Technology
[0002] With the growth of network traffic and the increasing demand for real-time performance, traditional networks are struggling to meet the stringent requirements of modern time-sensitive data transmission. To address this challenge, Time-Sensitive Networking (TSN) has been introduced into industrial networks. Through standards such as IEEE 802.1AS and IEEE 802.1Qbv, it provides bounded latency, meeting the high real-time performance and high reliability requirements of industrial networks.
[0003] The TSN controller manages and allocates traffic, monitoring key parameters in real time, such as network topology, bandwidth usage, and switch status. Accurate prediction of node TSN traffic provides a basis for network management, helping to avoid network congestion and improve management efficiency. Through traffic prediction, administrators can understand switch traffic trends, enabling the controller to more accurately configure traffic and allocate bandwidth, thereby ensuring the efficient and stable operation of the network.
[0004] Network traffic prediction methods are generally divided into two categories: traditional methods and deep learning methods. Traditional methods (such as statistical methods and machine learning methods) are limited by their reliance on strong assumptions and difficulty in modeling complex dependencies. Deep learning methods (such as recurrent neural networks, convolutional neural networks, and graph neural networks) often use single temporal and spatial features for modeling, neglecting the temporal characteristics of nodes across different time dimensions.
[0005] The problem addressed by this invention is how to learn time features at different granularities and improve TSN traffic prediction performance. Summary of the Invention
[0006] This invention addresses the problems existing in the prior art by providing a TSN traffic prediction method based on spatiotemporal feature fusion. This method can improve the accuracy of TSN traffic prediction, significantly enhance the intelligence level of network management, and accurately predict traffic trends, enabling the controller to optimize traffic configuration and bandwidth allocation, avoid potential network congestion, and improve network efficiency and stability.
[0007] To solve the above technical problems, the present invention provides the following technical solution: A TSN traffic prediction method based on spatiotemporal feature fusion, which is based on a ring network composed of several TSN switches, with each TSN switch connected to a terminal, including the following steps:
[0008] S1. Construct an adjacency matrix A using switches as network nodes and collect network traffic within a preset time period;
[0009] S2. Preprocess the network traffic with a preset step size S to obtain a dataset. Divide the dataset into a training set X and a test set X. ;
[0010] S3. Using the adjacency matrix A and the network traffic of the training set X as input, and spatiotemporal features as output, construct a spatiotemporal fusion module.
[0011] Using network traffic from training set X as input and coarse-grained temporal features as output, a coarse-grained temporal module is constructed.
[0012] Using network traffic from training set X as input and fine-grained temporal features as output, a fine-grained temporal module is constructed.
[0013] A prediction module is constructed by taking the network traffic, spatiotemporal features, coarse-grained temporal features, and fine-grained temporal features of the training set X as inputs and the network traffic of the next F steps as output.
[0014] Based on the aforementioned spatiotemporal fusion module, coarse-grained time module, fine-grained time module, and prediction module, a spatiotemporal feature fusion TSN traffic prediction network is constructed.
[0015] Using the current network traffic of training set X and the adjacency matrix Using the network traffic of the next F steps as input, train the TSN traffic prediction network that fuses spatiotemporal features to obtain the network traffic prediction model M;
[0016] S4, Test set The current network traffic and the adjacency matrix A are input into the network traffic prediction model M to obtain the predicted network traffic for the next time step.
[0017] Furthermore, the aforementioned step S2 includes the following sub-steps:
[0018] S2.1. Robust normalization methods are used to process network traffic to obtain a standardized dataset. The standardization method is as follows:
[0019] in, Represents the original data of the node. This represents the median of the nodes. The interquartile range of a node is the difference between the third quartile and the first quartile.
[0020] S2.2, the standardized dataset With preset step size To slide the window, including the history section... Step 1 is part of the dataset. The steps are used as the label part of the dataset to obtain the dataset;
[0021] S2.3. Divide the dataset into training sets at a ratio of 8:2. and test set .
[0022] Furthermore, in step S3 above, when constructing the TSN traffic prediction network that fuses spatiotemporal features, the network traffic and spatiotemporal features of the training set X are used as the basis. Coarse-grained time characteristics Fine-grained time characteristics The input is weighted and fused, and the future network traffic in step F is taken as the output to construct a prediction module. The weighted fusion formula is as follows:
[0023]
[0024] Here, FNN represents a linear transformation.
[0025] Furthermore, in step S3 above, the spatiotemporal fusion module is configured to perform the following actions:
[0026] A-3.1 The node is implemented using the following formula. and nodes Calculation of correlation coefficient:
[0027]
[0028] in, and It is a weight matrix. and It is node data. This indicates a splicing operation. It is an activation function. ,in Indicates input data, , ;
[0029] A-3.2, Using the adjacency matrix The correlation coefficient is adjusted as follows: when there is no connection between the two nodes, the correlation coefficient is assigned a value of negative infinity; otherwise, the correlation coefficient remains unchanged.
[0030] A-3.3. Based on the following formula, normalize the correlation coefficients of all nodes in the network topology:
[0031]
[0032] A-3.4. Employing a multi-head attention mechanism, the correlation coefficients of nodes across multiple dimensions are merged to achieve multi-dimensional feature learning and obtain spatiotemporal features. .
[0033] Furthermore, in step S3 above, a coarse-grained temporal module and a fine-grained temporal module are constructed based on dilated convolution;
[0034] The coarse-grained temporal module first achieves a specific dimension mapping based on linear transformation. Then, it uses three layers of dilated convolutions with dilation factors of 1, 2, and 4 to achieve learning over a broader spatial scope. Finally, it performs dimensional mapping again through linear transformation to obtain coarse-grained temporal features. .
[0035] Furthermore, in step S3 mentioned above, the fine-grained temporal module first performs dimensionality mapping based on linear transformation, then performs finer-grained feature learning based on two layers of dilated convolutions with dilation factors of 1 and 2, and finally obtains fine-grained temporal features through linear transformation and the ReLU activation function. .
[0036] Furthermore, in step S3 above, when training the TSN traffic prediction network with spatiotemporal feature fusion, the gradient descent algorithm is used to backpropagate the model's prediction output and labels according to the following loss function to obtain the final prediction model. :
[0037]
[0038] in:
[0039] ,
[0040] In the formula, The labels representing the dataset, This represents the predicted output of the model. It's a hyperparameter;
[0041]
[0042] in the formula It is the correlation coefficient of the spatiotemporal fusion module. These are the linear transformation weighting coefficients between the coarse-grained and fine-grained time modules. These are the linear transformation weighting coefficients of the prediction module. It is the square of the L2 norm of the weighting coefficient.
[0043] Another aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the methods described in the present invention.
[0044] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any of the methods described in the present invention.
[0045] Compared with the prior art, the beneficial technical effects of the present invention using the above technical solution are as follows:
[0046] 1. By considering both coarse and fine granular temporal features, it can learn temporal features of different dimensions, thereby further improving the performance of the prediction model.
[0047] 2. A spatiotemporal feature fusion architecture is proposed to effectively integrate spatiotemporal features and significantly improve the overall performance of the prediction model.
[0048] 3. Introduce L2 regularization into the loss function to prevent overfitting during model training and enhance the model's generalization ability and prediction performance. Attached Figure Description
[0049] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0050] To better understand the technical content of the present invention, specific embodiments are described below in conjunction with the accompanying drawings.
[0051] In this invention, various aspects of the invention are described with reference to the accompanying drawings, in which numerous illustrative embodiments are shown. Embodiments of the invention are not limited to those depicted in the drawings. It should be understood that the invention is implemented through any of the various concepts and embodiments described above, as well as the concepts and embodiments described in detail below, because the concepts and embodiments disclosed herein are not limited to any particular implementation. Furthermore, some aspects of the invention disclosed may be used alone or in any suitable combination with other aspects of the invention disclosed.
[0052] refer to Figure 1 This invention provides a TSN traffic prediction method based on spatiotemporal feature fusion, the steps of which are as follows:
[0053] S1. Based on the network environment, an adjacency matrix A is constructed using switches as network nodes, and network traffic within a preset time period is collected. In this embodiment, the network consists of a ring network composed of four TNS switches, with each TNS switch connecting to various terminals.
[0054] Building an adjacency matrix using switches as network nodes , where 1 indicates that there is a connection between the two nodes, and 0 indicates that there is no connection between the two nodes.
[0055] Based on network nodes, network traffic is collected over a period of time. Table 1 shows the network traffic passing through each node within 2 seconds.
[0056] Table 1
[0057]
[0058] S2. Preprocess the network traffic with a preset step size S to obtain a dataset. Divide the dataset into a training set X and a test set X. Specifically, it includes the following sub-steps:
[0059] S2.1. Robust normalization methods are used to process network traffic to obtain a standardized dataset. The standardization method is as follows:
[0060] in, Represents the original data of the node. This represents the median of the nodes. The interquartile range of a node is the difference between the third quartile and the first quartile.
[0061] Robust standardization is applied to each node individually, using the median and interquartile range to reduce the impact of outliers on data distribution. Furthermore, standardization for each node individually reduces the influence of data distribution among nodes, preventing data from being overlooked due to uneven network traffic. Table 2 shows the standardized network traffic data.
[0062] Table 2
[0063]
[0064] S2.2, the standardized dataset With preset step size To slide the window, including the history section... Step 1 is part of the dataset. The steps are used as the label part of the dataset to obtain the dataset;
[0065] In this embodiment, the preset step size is 12. When constructing the dataset, the historical 12-step data is used as the data part of the dataset, and the 13th element is used as the label part of the dataset, thus obtaining the dataset. In this embodiment, based on the 14-step data in Table 2, the following two datasets can be constructed:
[0066]
[0067] S2.3. Divide the dataset into training sets at a ratio of 8:2. and test set .
[0068] S3. Using the adjacency matrix A and the network traffic of the training set X as input, and the spatiotemporal features as output, a spatiotemporal fusion module is constructed. The spatiotemporal fusion module is configured to perform the following actions:
[0069] A-3.1 The node is implemented using the following formula. and nodes Calculation of correlation coefficient:
[0070]
[0071] in, and It is a weight matrix. and It is node data. This indicates a splicing operation. It is an activation function. ,in Indicates input data, , ;
[0072] A-3.2, Using the adjacency matrix The correlation coefficient is adjusted as follows: when there is no connection between the two nodes, the correlation coefficient is assigned a value of negative infinity; otherwise, the correlation coefficient remains unchanged.
[0073] A-3.3. Based on the following formula, normalize the correlation coefficients of all nodes in the network topology:
[0074]
[0075] A-3.4. Employing a multi-head attention mechanism, the correlation coefficients of nodes across multiple dimensions are merged to achieve multi-dimensional feature learning and obtain spatiotemporal features. .
[0076] Using network traffic from training set X as input and coarse-grained temporal features as output, a coarse-grained temporal module is constructed based on dilated convolutions. Similarly, using network traffic from training set X as input and fine-grained temporal features as output, a fine-grained temporal module is constructed based on dilated convolutions. Specifically, the coarse-grained temporal module first achieves a specific dimension mapping based on linear transformation. Then, it achieves learning over a wider spatial range using three layers of dilated convolutions with dilation factors of 1, 2, and 4. Finally, through linear transformation, it performs dimension mapping to obtain the coarse-grained temporal features. The fine-grained temporal module first performs dimensionality mapping based on linear transformation. Then, it uses two layers of dilated convolutions with dilation factors of 1 and 2 to achieve finer-grained feature learning. Finally, it obtains fine-grained temporal features through linear transformation and the ReLU activation function. .
[0077] A prediction module is constructed by taking the network traffic, spatiotemporal features, coarse-grained temporal features, and fine-grained temporal features of the training set X as inputs and the network traffic of the next F steps as output.
[0078] Based on the aforementioned spatiotemporal fusion module, coarse-grained temporal module, fine-grained temporal module, and prediction module, a spatiotemporal feature fusion TSN traffic prediction network is constructed. When constructing the spatiotemporal feature fusion TSN traffic prediction network, the network traffic and spatiotemporal features of the training set X are used as the basis. Coarse-grained time characteristics Fine-grained time characteristics The input is weighted and fused, and the future network traffic in step F is taken as the output to construct a prediction module. The weighted fusion formula is as follows:
[0079]
[0080] Here, FNN represents a linear transformation.
[0081] Using the current network traffic of training set X and the adjacency matrix Using the network traffic of the next F steps as input and the network traffic of the next F steps as output, a TSN traffic prediction network with spatiotemporal feature fusion is trained to obtain a network traffic prediction model M. When training the TSN traffic prediction network with spatiotemporal feature fusion, the gradient descent algorithm is used to backpropagate the predicted output of the model with the labels according to the following loss function to obtain the final prediction model. :
[0082]
[0083] in:
[0084] ,
[0085] In the formula, The labels representing the dataset, This represents the predicted output of the model. It's a hyperparameter;
[0086]
[0087] in the formula It is the correlation coefficient of the spatiotemporal fusion module. These are the linear transformation weighting coefficients between the coarse-grained and fine-grained time modules. These are the linear transformation weighting coefficients of the prediction module. It is the square of the L2 norm of the weighting coefficient.
[0088] S4, Test set The current network traffic and the adjacency matrix A are input into the network traffic prediction model M to obtain the predicted network traffic for the next time step.
[0089] In this embodiment, two of the most recent methods in the field (GMAN and ASTGN) are selected as benchmarks to predict network traffic in the next F steps. Table 3 shows the prediction performance of each model in the next 10 steps. The MAE evaluation index is used; the smaller the value, the better the model performance. It can be seen that this invention can further improve the performance of the network traffic prediction model.
[0090] Table 3
[0091]
[0092] Another aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the methods described in this embodiment.
[0093] The present invention also provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor of the steps of any of the methods described in this embodiment.
[0094] While the present invention has been described above with reference to preferred embodiments, it is not intended to limit the invention. Those skilled in the art can make various modifications and refinements without departing from the spirit and scope of the invention. Therefore, the scope of protection of the present invention shall be determined by the claims.
Claims
1. A TSN traffic prediction method based on spatiotemporal feature fusion, comprising a ring network of several TSN switches, each TSN switch connecting to a terminal, characterized in that, Includes the following steps: S1. Construct an adjacency matrix A using switches as network nodes and collect network traffic within a preset time period; S2. Preprocess the network traffic with a preset step size S to obtain a dataset. Divide the dataset into a training set X and a test set X. ; S3. Using the adjacency matrix A and the network traffic of the training set X as input, and spatiotemporal features as output, construct a spatiotemporal fusion module. Using network traffic from training set X as input and coarse-grained temporal features as output, a coarse-grained temporal module is constructed. Using network traffic from training set X as input and fine-grained temporal features as output, a fine-grained temporal module is constructed. A prediction module is constructed by taking the network traffic, spatiotemporal features, coarse-grained temporal features, and fine-grained temporal features of the training set X as inputs and the network traffic of the next F steps as output. Based on the aforementioned spatiotemporal fusion module, coarse-grained time module, fine-grained time module, and prediction module, a spatiotemporal feature fusion TSN traffic prediction network is constructed. Using the current network traffic of training set X and the adjacency matrix Using the network traffic of the next F steps as input, train the TSN traffic prediction network that fuses spatiotemporal features to obtain the network traffic prediction model M; The spatiotemporal fusion module is configured to perform the following actions: A-3.1 The node is implemented using the following formula. and nodes Calculation of correlation coefficient: , in, and It is a weight matrix. and It is node data. This indicates a splicing operation. It is an activation function. ,in Indicates input data, , ; A-3.2, Using the adjacency matrix The correlation coefficient is adjusted as follows: when there is no connection between the two nodes, the correlation coefficient is assigned a value of negative infinity; otherwise, the correlation coefficient remains unchanged. A-3.
3. Based on the following formula, normalize the correlation coefficients of all nodes in the network topology: , A-3.
4. Employing a multi-head attention mechanism, the correlation coefficients of nodes across multiple dimensions are merged to achieve multi-dimensional feature learning and obtain spatiotemporal features. ; S4, Test set The current network traffic and the adjacency matrix A are input into the network traffic prediction model M to obtain the predicted network traffic for the next time step.
2. The TSN traffic prediction method based on spatiotemporal feature fusion according to claim 1, characterized in that, Step S2 includes the following sub-steps: S2.
1. Robust normalization methods are used to process network traffic to obtain a standardized dataset. The standardization method is as follows: , in, Represents the original data of the node. This represents the median of the nodes. The interquartile range of a node is the difference between the third quartile and the first quartile. S2.2, the standardized dataset With preset step size To slide the window, including the history section... Step 1 is part of the dataset. The steps are used as the label part of the dataset to obtain the dataset; S2.
3. Divide the dataset into training sets at a ratio of 8:
2. and test set .
3. The TSN traffic prediction method based on spatiotemporal feature fusion according to claim 1, characterized in that, In step S3, when constructing the TSN traffic prediction network that fuses spatiotemporal features, the network traffic and spatiotemporal features of the training set X are used. Coarse-grained time characteristics Fine-grained time characteristics The input is weighted and fused, and the future network traffic in step F is taken as the output to construct a prediction module. The weighted fusion formula is as follows: , Here, FNN represents a linear transformation.
4. The TSN traffic prediction method based on spatiotemporal feature fusion according to claim 1, characterized in that, In step S3, a coarse-grained temporal module and a fine-grained temporal module are constructed based on dilated convolution; The coarse-grained temporal module first achieves a specific dimension mapping based on linear transformation. Then, it uses three layers of dilated convolutions with dilation factors of 1, 2, and 4 to achieve learning over a broader spatial scope. Finally, it performs dimensional mapping again through linear transformation to obtain coarse-grained temporal features. .
5. The TSN traffic prediction method based on spatiotemporal feature fusion according to claim 4, characterized in that, In step S3, the fine-grained temporal module first performs dimensionality mapping based on linear transformation, then achieves finer-grained feature learning based on two layers of dilated convolutions with dilation factors of 1 and 2, and finally obtains fine-grained temporal features through linear transformation and the ReLU activation function. .
6. The TSN traffic prediction method based on spatiotemporal feature fusion according to claim 5, characterized in that, In step S3, when training the TSN traffic prediction network with spatiotemporal feature fusion, the gradient descent algorithm is used to backpropagate the model's prediction output and labels according to the following loss function to obtain the final prediction model. : , in: , In the formula, The labels representing the dataset, This represents the predicted output of the model. It's a hyperparameter; , in the formula It is the correlation coefficient of the spatiotemporal fusion module. These are the linear transformation weighting coefficients between the coarse-grained and fine-grained time modules. These are the linear transformation weighting coefficients of the prediction module. It is the square of the L2 norm of the weighting coefficient.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.