TSN traffic prediction method and system based on spatio-temporal feature fusion
By adopting the spatiotemporal feature fusion method in TSN traffic prediction, combining multi-head attention mechanism and hollow convolution, and fusing spatiotemporal features and temporal features of different granularity, the problem of low TSN traffic prediction performance in the existing technology is solved, and higher prediction accuracy and intelligent network management are achieved.
Patent Information
- Application Number
- CN202510187668.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-02-20
AI Technical Summary
The prior art is difficult to effectively learn time characteristics of different granularity, resulting in low TSN traffic prediction performance.
The TSN flow prediction method based on spatiotemporal feature fusion is adopted, and the space-time fusion module, coarse-grained time module and fine-grained time module are constructed, combining multi-head attention mechanism and hollow convolution to fuse spatiotemporal features and time features of different granularity.
It significantly improves the accuracy of TSN traffic prediction, enhances the intelligence level of network management, can accurately predict traffic trends, optimize traffic configuration and bandwidth allocation, avoid network congestion, and improve network efficiency and stability.
Smart Images

Figure CN120017531A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of network traffic prediction, and specifically relates to a TSN traffic prediction method and system based on spatiotemporal feature fusion. Background Art
[0002] With the growth of network traffic and the increasing demand for real-time performance, traditional networks are unable to meet the strict requirements of modern time-sensitive data transmission. To address this challenge, time-sensitive networking (TSN) has been introduced into industrial networks, providing bounded delays through standards such as IEEE 802.1AS and IEEE 802.1Qbv to meet the needs of industrial networks for high real-time performance and high reliability.
[0003] TSN controllers are used to manage and distribute traffic, and monitor key parameters in real time, such as network topology, bandwidth usage, and switch status. Accurately predicting the TSN traffic of nodes can provide a basis for network management, help avoid network congestion, and improve management efficiency. Through traffic prediction, administrators can understand the traffic trend of switches, allowing controllers to more accurately configure traffic and allocate bandwidth, thereby ensuring 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 recursive neural networks, convolutional neural networks, and graph neural networks) mostly use single temporal features and spatial features for modeling, ignoring the temporal characteristics of nodes in different time dimensions.
[0005] How to learn time features of different granularities and improve TSN traffic prediction performance is the problem faced by the present invention. Summary of the invention
[0006] In response to the problems existing in the prior art, the present invention provides a TSN traffic prediction method based on the fusion of spatiotemporal features, which can improve the accuracy of TSN traffic prediction, significantly enhance the level of intelligent network management, and accurately predict traffic trends so that the controller can optimize traffic configuration and bandwidth allocation, avoid potential network congestion, and improve network efficiency and stability.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions: A TSN traffic prediction method based on spatiotemporal feature fusion, based on a ring network composed of several TSN switches, each TSN switch is connected to each terminal, comprising the following steps:
[0008] S1. Build an adjacency matrix A with switches as network nodes and collect network traffic within a preset time period;
[0009] S2, preprocessing the network traffic with a preset step size S to obtain a data set, and dividing the data set to obtain a training set X and a test set T;
[0010] S3, using the adjacency matrix A and the network traffic of the training set X as input and the spatiotemporal features as output to build a spatiotemporal fusion module.
[0011] Taking the network traffic of training set X as input and coarse-grained time features as output, a coarse-grained time module is constructed. Taking the network traffic of training set X as input and fine-grained time features as output, a fine-grained time module is constructed. Taking the network traffic, spatiotemporal features, coarse-grained time features, and fine-grained time features of training set X as input and the network traffic of the next F steps as output, a prediction module is constructed.
[0012] Based on the above-mentioned spatiotemporal fusion module, coarse-grained time module, fine-grained time module, and prediction module, a TSN traffic prediction network with spatiotemporal feature fusion is constructed;
[0013] Taking the current network traffic of the training set X and the adjacency matrix A as input and the network traffic of the next F steps as output, the TSN traffic prediction network with spatiotemporal feature fusion is trained to obtain the network traffic prediction model M;
[0014] S4. Input the current network traffic in the test set T and the adjacency matrix A into the network traffic prediction model M to obtain the predicted network traffic at the next moment.
[0015] Furthermore, the aforementioned step S2 includes the following sub-steps:
[0016] S2.1. Use the robust standardization method to process network traffic and obtain the standardized data set X t , the standardization method is as follows:
[0017]
[0018] Among them, X o Represents the original data of the node, X m represents the median of the node, X IQR The interquartile range of the node is the difference between the third quartile and the first quartile;
[0019] S2.2, the standardized data set X t Slide the window with a preset step size S, where the historical S steps are used as the data part of the data set, and the S+1 step is used as the label part of the data set to obtain the data set;
[0020] S2.3. Divide the data set into a training set X and a test set T in a ratio of 8:2.
[0021] Furthermore, in the aforementioned step S3, when constructing a TSN traffic prediction network with spatiotemporal feature fusion, the network traffic of the training set X, the spatiotemporal feature X st , coarse-grained temporal feature X ct , fine-grained temporal features X ft Input, perform weighted fusion, and output the network traffic of the next F steps to build a prediction module. The weighted fusion formula is as follows:
[0022] X wf =0.5 FFN(X)+0.5 X st +0.5·X ct +0.7·X ft
[0023] Among them, FNN represents linear transformation.
[0024] Furthermore, in the aforementioned step S3, the spatiotemporal fusion module is configured to perform the following actions: A-3.1 The following formula is used to calculate the correlation coefficient between node i and node j:
[0025] Coe ij = mish(W2[W1X i ||W1X j ])
[0026] Among them, W1 and W2 are weight matrices, X i and X j is the node data, || represents the concatenation operation. mish(·) is the activation function, mish(z)=z·tanh(softplus(z)), where z represents the input data, softplus(z)=log(1+e z );
[0027] A-3.2. Using the adjacency matrix A to adjust the correlation, specifically: when there is no connection between two nodes, the correlation coefficient is assigned a value of negative infinity, otherwise, the correlation coefficient remains unchanged;
[0028] A-3.3. Based on the following formula, normalize the correlation coefficients of all nodes in the network topology:
[0029] H = mish(softmax(Coe·W1X))
[0030] A-3.4. Use the multi-head attention mechanism to merge the correlation coefficients of nodes in multiple dimensions to achieve multi-dimensional feature learning and obtain the spatiotemporal feature X st .
[0031] Furthermore, in the aforementioned step S3, a coarse-grained time module and a fine-grained time module are constructed based on the dilated convolution;
[0032] The coarse-grained time module first realizes specific dimension mapping based on linear transformation, then realizes learning in a wider space based on 3 layers of dilation factors of 1, 2, and 4, and then performs dimension mapping through linear transformation to obtain the coarse-grained time feature X ct .
[0033] Furthermore, in the aforementioned step S3, the fine-grained time module first implements dimensional mapping based on linear transformation, then implements finer-grained feature learning based on two layers of dilation factors 1 and 2, and finally obtains the fine-grained time feature X through linear transformation and ReLU activation function. ft .
[0034] Furthermore, when the aforementioned step S3 trains the TSN traffic prediction network with spatiotemporal feature fusion, the predicted output and label of the model are back-propagated and trained using a gradient descent algorithm according to the following loss function to obtain the final prediction model M:
[0035] loss=loss H +loss l
[0036] in:
[0037]
[0038] In the formula, Y represents the label of the dataset. represents the predicted output of the model, and δ is a hyperparameter;
[0039]
[0040] W in the formula STF is the correlation coefficient of the spatiotemporal fusion module, W CFT and W PM are the linear conversion weight coefficients of the coarse and fine time module and the prediction module, is the square of the L2 norm of the weight coefficient.
[0041] Another aspect of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the methods described in the present invention when executing the computer program.
[0042] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of any one of the methods described in the present invention when executed by a processor.
[0043] Compared with the prior art, the beneficial technical effects of the present invention using the above technical solution are as follows:
[0044] 1. Considering both coarse and fine granularity temporal features, it is possible to learn temporal features of different dimensions and further improve the performance of the prediction model.
[0045] 2. Propose a spatiotemporal feature fusion architecture to effectively integrate spatiotemporal features and significantly improve the overall performance of the prediction model.
[0046] 3. Introduce L2 regularization in the loss function to prevent overfitting of model training and enhance the generalization ability and prediction performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0048] In order to better understand the technical content of the present invention, specific embodiments are given and described as follows in conjunction with the accompanying drawings.
[0049] Various aspects of the invention are described herein with reference to the accompanying drawings, in which many illustrative embodiments are shown. The embodiments of the invention are not limited to those described in the accompanying drawings. It should be understood that the invention is implemented by 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 in the invention are not limited to any implementation. In addition, some aspects disclosed in the invention may be used alone or in any appropriate combination with other aspects disclosed in the invention.
[0050] refer to Figure 1 The present invention provides a TSN traffic prediction method based on spatiotemporal feature fusion, the steps are as follows: S1, based on the network environment, an adjacency matrix A is constructed with switches as network nodes, and network traffic within a preset time period is collected; in this embodiment, the network is composed of 4 TNS switches forming a ring network, each TNS switch is connected to each terminal, and an adjacency matrix is constructed with switches as network nodes 1 indicates that there is a connection between the two nodes, and 0 indicates that there is no connection between the two nodes.
[0051] Based on the network nodes, the network traffic within a time period is collected. Table 1 is the network traffic table passing through each node within 2 seconds.
[0052] Table 1
[0053]
[0054] S2, preprocessing the network traffic with a preset step size S to obtain a data set, dividing the data set to obtain a training set X and a test set T; specifically comprising the following sub-steps:
[0055] S2.1. Use the robust standardization method to process network traffic and obtain the standardized data set X t , the standardization method is as follows:
[0056]
[0057] Among them, X o Represents the original data of the node, X m represents the median of the node, X IQR The interquartile range of the node is the difference between the third quartile and the first quartile;
[0058] Robust standardization is used for each node, and the median and interquartile range are used to reduce the impact of outliers on data distribution. On the other hand, standardization is used for each node to reduce the impact of data distribution between nodes and avoid the uneven node traffic in the network causing node data to be ignored. Table 2 is a data table of network traffic data after standardization.
[0059] Table 2
[0060]
[0061]
[0062] S2.2, the standardized data set X t Slide the window with a preset step size S, where the historical S steps are used as the data part of the data set, and the S+1 step is used as the label part of the data set to obtain the data set;
[0063] In this embodiment, the preset step length is 12. When constructing a data set, the historical 12-step data is used as the data part of the data set, and the 13th bit is used as the label part of the data set to obtain the data set. In this embodiment, according to the 14-step data in Table 2, the following two data sets can be constructed:
[0064]
[0065] S2.3. Divide the data set into a training set X and a test set T in a ratio of 8:2.
[0066] S3, using the adjacency matrix A and the network traffic of the training set X as input and the spatiotemporal features as output to construct a spatiotemporal fusion module, which is configured to perform the following actions:
[0067] A-3.1 The following formula is used to calculate the correlation coefficient between node i and node j:
[0068] Coe ij = mish(W2[W1Xi ||W1X j ])
[0069] Among them, W1 and W2 are weight matrices, X i and X j is the node data, || represents the concatenation operation. mish(·) is the activation function, mish(z)=z·tanh(softplus(z)), where z represents the input data, softplus(z)=log(1+e z );
[0070] A-3.2. Using the adjacency matrix A to adjust the correlation, specifically: when there is no connection between two nodes, the correlation coefficient is assigned a value of negative infinity, otherwise, the correlation coefficient remains unchanged;
[0071] A-3.3. Based on the following formula, normalize the correlation coefficients of all nodes in the network topology:
[0072] H = mish(softmax(Coe·W1X))
[0073] A-3.4. Use the multi-head attention mechanism to merge the correlation coefficients of nodes in multiple dimensions to achieve multi-dimensional feature learning and obtain the spatiotemporal feature X st .
[0074] The network traffic of training set X is used as input and the coarse-grained time features are used as output. The coarse-grained time module is constructed based on dilated convolution. The network traffic of training set X is used as input and the fine-grained time features are used as output. The fine-grained time module is constructed based on dilated convolution. Specifically, the coarse-grained time module first realizes specific dimensional mapping based on linear transformation, and then realizes learning in a wider space based on 3 layers of dilated convolution with expansion factors of 1, 2, and 4. Then, the dimensional mapping is performed through linear transformation to obtain the coarse-grained time feature X. ct The fine-grained time module first implements dimensional mapping based on linear transformation, then implements finer-grained feature learning based on two layers of dilation factors 1 and 2. Finally, through linear transformation and ReLU activation function, the fine-grained time feature X is obtained. ft .
[0075] The prediction module is constructed with the network traffic, spatiotemporal features, coarse-grained time features, and fine-grained time features of the training set X as input and the network traffic in the next F steps as output;
[0076] Based on the above-mentioned spatiotemporal fusion module, coarse-grained time module, fine-grained time module, and prediction module, a TSN traffic prediction network with spatiotemporal feature fusion is constructed; when constructing a TSN traffic prediction network with spatiotemporal feature fusion, the network traffic of the training set X, the spatiotemporal feature X st , coarse-grained temporal feature X ct , fine-grained temporal features X ft Input, perform weighted fusion, and output the network traffic of the next F steps to build a prediction module. The weighted fusion formula is as follows:
[0077] X wf =0.5 FFN(X)+0.5 X st +0.5·X ct +0.7·X ft
[0078] Among them, FNN represents linear transformation.
[0079] Taking the current network traffic of the training set X and the adjacency matrix A as input and the network traffic of the future F steps as output, the TSN traffic prediction network with spatiotemporal features is trained to obtain the network traffic prediction model M. When training the TSN traffic prediction network with spatiotemporal features, the predicted output and label of the model are back-propagated using the gradient descent algorithm according to the following loss function to obtain the final prediction model M:
[0080] loss=loss H +loss l
[0081] in:
[0082]
[0083] In the formula, Y represents the label of the dataset. represents the predicted output of the model, and δ is a hyperparameter;
[0084]
[0085] W in the formula STF is the correlation coefficient of the spatiotemporal fusion module, W CFT and W PM are the linear conversion weight coefficients of the coarse and fine time module and the prediction module, is the square of the L2 norm of the weight coefficient.
[0086] S4. Input the current network traffic in the test set T and the adjacency matrix A into the network traffic prediction model M to obtain the predicted network traffic at the next moment.
[0087] In this embodiment, two of the latest methods in the field (GMAN and ASTGN) are selected as benchmarks to predict the network traffic in the next F steps. Table 3 is a table of the prediction performance of each model in the next 10 steps. Among them, the smaller the value of the MAE evaluation index, the better the model performance. It can be found that the present invention can further improve the performance of the network traffic prediction model.
[0088] Table 3
[0089] 1 2 3 4 5 6 7 8 9 10 GMAN 2.13 2.30 2.36 2.25 2.33 2.38 2.29 2.31 2.38 2.32 ASTGN 3.58 3.58 3.44 3.73 3.55 3.52 3.62 3.56 3.54 3.43 The present invention 1.31 1.32 1.33 1.35 1.35 1.37 1.38 1.39 1.40 1.40
[0090] 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 implements the steps of any one of the methods described in the present embodiment when executing the computer program.
[0091] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and the computer program is used by a processor to execute the steps of any one of the methods described in the present embodiment.
[0092] Although the present invention has been described above with preferred embodiments, it is not intended to limit the present invention. A person skilled in the art of the present invention may make various modifications and improvements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be determined by the definition of the claims.
Claims
1. A TSN traffic prediction method based on spatiotemporal feature fusion, based on a ring network composed of several TSN switches, each TSN switch is connected to each terminal, characterized in that: The following steps are involved: S1. Build an adjacency matrix A with switches as network nodes and collect network traffic within a preset time period; S2, preprocessing the network traffic with a preset step size S to obtain a data set, and dividing the data set to obtain a training set X and a test set T; S3, taking the adjacency matrix A and the network traffic of the training set X as input and the spatiotemporal features as output to construct a spatiotemporal fusion module, taking the network traffic of the training set X as input and the coarse-grained time features as output to construct a coarse-grained time module, The fine-grained time module is constructed with the network traffic of the training set X as input and the fine-grained time features as output. The prediction module is constructed with the network traffic, spatiotemporal features, coarse-grained time features, and fine-grained time features of the training set X as input and the network traffic in the next F steps as output; Based on the above-mentioned spatiotemporal fusion module, coarse-grained time module, fine-grained time module, and prediction module, a TSN traffic prediction network with spatiotemporal feature fusion is constructed; Taking the current network traffic of the training set X and the adjacency matrix A as input and the network traffic of the next F steps as output, the TSN traffic prediction network with spatiotemporal feature fusion is trained to obtain the network traffic prediction model M; S4. Input the current network traffic in the test set T and the adjacency matrix A into the network traffic prediction model M to obtain the predicted network traffic at the next moment.
2. According to claim 1, a TSN traffic prediction method based on spatiotemporal feature fusion is characterized in that: Step S2 includes the following sub-steps: S2.
1. Use the robust standardization method to process network traffic and obtain the standardized data set X t , the standardization method is as follows: Among them, X o Represents the original data of the node, X m represents the median of the node, X IQR The interquartile range of the node is the difference between the third quartile and the first quartile; S2.2, the standardized data set X t Slide the window with a preset step size S, where the historical S steps are used as the data part of the data set, and the S+1 step is used as the label part of the data set to obtain the data set; S2.
3. Divide the data set into a training set X and a test set T in a ratio of 8:
2.
3. According to the TSN traffic prediction method based on spatiotemporal feature fusion according to claim 1, it is characterized in that: In step S3, when constructing a TSN traffic prediction network with spatiotemporal feature fusion, the network traffic of training set X, spatiotemporal feature X st , coarse-grained temporal features X ct , fine-grained temporal features X ft Input, perform weighted fusion, and output the network traffic of the next F steps to build a prediction module. The weighted fusion formula is as follows: X wf =0.5·FFN(X)+0.5·X st +0.5·X ct +0.7·X ft Among them, FNN represents linear transformation.
4. According to claim 1, a TSN traffic prediction method based on spatiotemporal feature fusion is characterized in that: In step S3, the spatiotemporal fusion module is configured to perform the following actions: A-3.1 The following formula is used to calculate the correlation coefficient between node i and node j: Coe ij =mish(W2[W1X i ||W1X j ]) Among them, W1 and W2 are weight matrices, X i and X j is the node data, || represents the concatenation operation, mish(·) is the activation function, mish(z) = z·tanh(softplus(z)), where z represents the input data, softplus(z)=log(1+e z ); A-3.
2. Using the adjacency matrix A to adjust the correlation, specifically: when there is no connection between 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: H = mish(softmax(Coe·W1X)) A-3.
4. Use the multi-head attention mechanism to merge the correlation coefficients of nodes in multiple dimensions to achieve multi-dimensional feature learning and obtain the spatiotemporal feature X st .
5. According to the TSN traffic prediction method based on spatiotemporal feature fusion according to claim 1, it is characterized in that: In step S3, a coarse-grained time module and a fine-grained time module are constructed based on the dilated convolution; The coarse-grained time module first realizes specific dimension mapping based on linear transformation, then realizes learning in a wider space based on 3 layers of dilation factors of 1, 2, and 4, and then performs dimension mapping through linear transformation to obtain the coarse-grained time feature X ct .
6. According to the TSN traffic prediction method based on spatiotemporal feature fusion according to claim 5, it is characterized in that: In step S3, the fine-grained time module first implements dimensional mapping based on linear transformation, then implements finer-grained feature learning based on two layers of dilation factors 1 and 2. Finally, through linear transformation and ReLU activation function, the fine-grained time feature X is obtained. ft .
7. According to claim 5, a TSN traffic prediction method based on spatiotemporal feature fusion is characterized in that: When step S3 trains the TSN traffic prediction network with spatiotemporal feature fusion, the predicted output and label of the model are back-propagated using the gradient descent algorithm according to the following loss function to obtain the final prediction model M: loss=loss H +loss l in: In the formula, Y represents the label of the dataset. represents the predicted output of the model, and δ is a hyperparameter; W in the formula STF is the correlation coefficient of the spatiotemporal fusion module, W CFT and W PM are the linear conversion weight coefficients of the coarse and fine time module and the prediction module, respectively, ||·|| 2 2 is the square of the L2 norm of the weight coefficient.
8. 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, the steps of the method according to any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Network traffic prediction method, computer device, product and storage medium
CN114422382A
Network traffic matrix prediction method based on self-attention mechanism
CN114553718A
Large-scale SDN network traffic prediction method and system
CN115941510A
Network traffic prediction method based on space-time diagram multi-attention mechanism
CN117880871A
Cloud edge collaborative load prediction method based on multi-tenant edge cloud
CN118250183A