Method and device for calculating packet loss rate of equipment, equipment and medium
By utilizing feature engineering and spatiotemporal feature extraction coding structures on edge node devices such as OLTs, combined with multi-head attention mechanisms and convolutional temporal structures, the problems of edge node devices being unable to actively detect and statistical methods making misjudgments are solved, thus achieving efficient and accurate packet loss rate calculation.
Patent Information
- Application Number
- CN202511332778.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-18
- Publication Date
- 2025-11-18
AI Technical Summary
On edge node devices such as OLTs, due to limitations in device characteristics or confidentiality requirements, it is impossible to actively send test packets to the target terminal, which makes it impossible to implement traditional active probing methods. Furthermore, statistical packet loss rate methods suffer from serious misjudgments in complex network environments and cannot accurately calculate packet loss rates.
By employing feature engineering and prior knowledge to filter message features, combining spatiotemporal feature extraction to extract encoding and decoder units, and using multi-head attention mechanisms and convolutional temporal structures to capture message interaction features, a special network structure is designed to achieve efficient and accurate packet loss rate calculation without the need for active packet sending.
It can efficiently and accurately calculate packet loss rate in various device characteristics and complex network environments, and is applicable to various edge node devices. It can capture standard and unconventional packet loss while reducing computing resource consumption.
Smart Images

Figure CN120979985A_ABST
Abstract
Description
Technical Field
[0001] This disclosure belongs to the field of communication technology, and in particular relates to a method, apparatus, device and medium for calculating packet loss rate of a device. Background Technology
[0002] Packet loss rate is a crucial indicator of network quality and is widely used in various communication devices. The main methods for calculating packet loss rate are divided into active probing and statistical methods. The former involves sending test packets to the target device and comparing them with the packets returned by the target device to obtain the network's packet loss rate. The latter uses statistical analysis to identify validly lost packets within complete message information and calculate the packet loss rate.
[0003] When devices are located at edge nodes such as OLTs, they are limited by device characteristics or confidentiality requirements, and can only passively observe network traffic, unable to actively send test packets to target terminals. Therefore, probing methods that rely on active packet sending (such as active probing) cannot be implemented in this scenario. Furthermore, packet loss rate methods based on statistical analysis are limited by the complex and variable network environment in the current network, and some applications use methods such as repeated packet sending or long-delayed responses to achieve certain application-layer goals. For example, some applications use repeated packet sending strategies to ensure reliability, causing traditional statistical methods to misjudge valid packets as lost packets, thus rendering standard packet loss judgment methods in the TCP protocol stack, such as multiple packet sending and long periods without response, ineffective. Summary of the Invention
[0004] To address the aforementioned issues, this disclosure provides a method, apparatus, device, and medium for calculating device packet loss rate, which can calculate the packet loss rate of a device regardless of its characteristics.
[0005] Firstly, a method for calculating device packet loss rate is provided, including: The message features that can be used to calculate the packet loss rate are obtained from the raw data. These message features are selected through feature engineering and prior knowledge. The message stream data is segmented and windowed to obtain multiple data blocks; Add a relative position code to each data block to represent the position of each abstracted data block; The message features, the size of the message stream data, the number of data blocks, and the relative position encoding are input into the trained packet loss rate calculation model to obtain the packet loss rate. The trained packet loss rate calculation model includes a spatiotemporal feature extraction encoding structure and a decoder unit. The spatiotemporal feature extraction encoding structure includes a multi-head attention mechanism and a convolutional temporal structure connected to it. The multi-head attention mechanism includes an attention mechanism that focuses on global semantics. The spatiotemporal feature extraction coding structure is used to extract features from the input data block in both time and space to obtain the feature information of each data block. The decoder unit is used to project the hidden dimensions in the feature information back to obtain the features of the data, and calculate the packet loss rate based on the features of the data.
[0006] Furthermore, the multi-head attention mechanism also includes other attention mechanisms, namely: attention mechanisms that focus on time and direction and / or SEQ Unresponsive attention mechanisms; among them, attention mechanisms focusing on time and direction are used to emphasize capturing the temporal features of message interactions in two directions. SEQ Unresponsive attention mechanisms are used to emphasize the response relationships between captured packets and the number of retransmissions; The spatiotemporal feature extraction coding structure also includes a splicing unit; The splicing unit is used to splice features captured by an attention mechanism that focuses on global semantics and features captured by other attention mechanisms.
[0007] Furthermore, the convolutional temporal structure includes a main branch, a first auxiliary branch, and a second auxiliary branch; wherein the result of element-wise multiplication of the output of the main branch and the output of the second auxiliary branch is then added to the output of the first auxiliary branch; The main branch is a Linear structure, used for feature representation and prediction, and outputs the prediction results; The first auxiliary branch consists of a series of independent linear layers, nonlinear activation layers, and alpha parameter layers, which are used to generate auxiliary features that are complementary to the main branch by utilizing the captured features. The alpha parameter layer is used to adjust the weights of the auxiliary branch. The second auxiliary branch includes linear attention and an activation function, which are used to generate a gating signal using the captured features. This gating signal is used to dynamically adjust the fusion ratio between the prediction output of the main branch and the auxiliary features output of the auxiliary branch.
[0008] Furthermore, the decoder unit specifically maps the feature information extracted from each data block directly to a scalar through a single-layer fully connected network. This scalar is the packet loss rate of that data block. The packet loss rate of the message stream data is obtained by weighted averaging of the packet loss rates of each data block.
[0009] Furthermore, message characteristics include: direction, ACK, SEQ, time offset value, and whether a response is received.
[0010] Secondly, a device for calculating packet loss rate is provided, comprising: The acquisition unit is used to extract message features from the raw data that can be used to calculate the packet loss rate. The message features are selected through feature engineering and prior knowledge. A segmentation unit is used to segment and window the message stream data to obtain multiple data blocks; Encoding unit, used to add relative position encoding to each data block to represent the position of each abstracted data block; The calculation unit is used to input the message features, the size of the message stream data, the number of data blocks and the relative position encoding into the trained packet loss rate calculation model to obtain the packet loss rate. The trained packet loss rate calculation model includes a spatiotemporal feature extraction encoding structure and a decoder unit. The spatiotemporal feature extraction encoding structure includes a multi-head attention mechanism and a convolutional temporal structure connected to it. The multi-head attention mechanism includes an attention mechanism that focuses on global semantics. The spatiotemporal feature extraction coding structure is used to extract features from the input data block in both time and space to obtain the feature information of each data block. The decoder unit is used to project the hidden dimensions in the feature information back to obtain the features of the data, and calculate the packet loss rate based on the features of the data.
[0011] Furthermore, the multi-head attention mechanism also includes other attention mechanisms, namely: a time- and direction-focused attention mechanism and / or an attention mechanism where the SEQ is not responded to; wherein, the time- and direction-focused attention mechanism is used to emphasize the message interaction time characteristics of capturing two directions, and the SEQ is not responded to attention mechanism is used to emphasize the response relationship and retransmission number between captured packets; The spatiotemporal feature extraction coding structure also includes a splicing unit; The splicing unit is used to splice features captured by an attention mechanism that focuses on global semantics and features captured by other attention mechanisms.
[0012] Furthermore, message characteristics include: direction, ACK, SEQ, time offset value, and whether a response is received.
[0013] Thirdly, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor implements the above method when executing programs stored in memory.
[0014] Fourthly, a computer storage medium is provided, wherein a computer program is stored therein, and the computer program, when executed by a processor, implements the above-described method.
[0015] Compared with the prior art, this disclosure has the following advantages: 1) Inputting message characteristics, data blocks, and relative position codes that can effectively calculate packet loss rate into the packet loss calculation model can calculate the packet loss rate of a device regardless of its characteristics; 2) This method improves the multi-head attention mechanism in the spatiotemporal feature extraction coding structure and adds an implicit information filtering mechanism to the GLU-gated linear unit network, achieving efficient and accurate packet loss rate calculation. A special network structure is designed to easily capture standard packet loss in the TCP protocol stack, while intelligently extracting effective information and capturing unconventional packet loss. Compared to mainstream active probing and statistical analysis methods, this method does not require active packet sending and can capture unconventional packet loss, efficiently and accurately calculating the packet loss rate, making it suitable for various edge node devices.
[0016] Other features and advantages of this disclosure will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the disclosure. The objects and other advantages of this disclosure may be realized and obtained by means of the structures pointed out in the description, claims and drawings. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A diagram illustrating a method for calculating device packet loss rate according to an embodiment of this disclosure is shown. Figure 2 A method for acquiring an input data stream according to an embodiment of the present disclosure is shown; Figure 3 A diagram illustrating a multi-head attention mechanism for adding attention across attention directions according to an embodiment of this disclosure is shown. Figure 4 A diagram illustrating the computation process of a multi-head attention mechanism according to an embodiment of this disclosure is shown. Figure 5 A convolutional temporal network diagram according to an embodiment of the present disclosure is shown; Figure 6 A diagram of a convolutional temporal network with added implicit information filtering according to an embodiment of the present disclosure is shown; Figure 7 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0020] The solutions of this disclosure are not limited to edge devices. The following embodiments use edge devices as an example for illustration. The solutions of this disclosure first introduce the specific processing of data in the packet loss rate calculation model, then introduce the training process of the packet loss rate calculation model, and finally introduce the use of the packet loss rate calculation model.
[0021] The specific processing procedure of data in the packet loss rate calculation model is as follows: like Figure 1 As shown, this is a method for calculating the packet loss rate of a device according to an embodiment of the present disclosure, which includes the following steps: Step 1: Obtain the raw data.
[0022] like Figure 2 As shown, for a TCP The message stream stores the content of each message and the time it arrives at the edge device. Then, each message undergoes the following processing to obtain information including direction, etc. ACK , SEQ The message features include packet size, time offset, and whether it has been responded to. These message features were selected through feature engineering and prior knowledge to effectively calculate the packet loss rate.
[0023] Specifically, the package is processed as follows: 1) Determine the direction of the message: Treat the message sent from the server to the client as a downlink stream and mark it with a value of "1"; otherwise, mark it with a value of "2".
[0024] 2) Determine ACK and SEQ : Parse its message content to obtain the current message ACK and SEQ .
[0025] 3) Determine the time offset value: Record the message with the smallest timestamp as the base time, and subtract the base time from the timestamp of each message packet as the time offset value.
[0026] 4) Determine the message characteristics that indicate whether a response flag has been set: According to the following formula (1) TCP The basic formula of the protocol stack is used to determine whether a message has been responded to.
[0027] (1) In formula (1) SEQ For the current message SEQ value, TCP_DATA_LEN For the current message TCP Layer message length, ACK In response to the message ACK Specifically, for the current message, if a response message can be found that satisfies the formula, then the current message is considered to have been responded to, and the "response binary flag" is set to "2"; otherwise, it is set to "1".
[0028] Step 2: Segment the message stream to obtain data blocks, and add relative position encoding to the data blocks.
[0029] The input data format is B x T x H, in B Specifically, it refers to the number of data points that deep learning can process in a single prediction or training iteration. Applied to the scheme disclosed herein... B Specifically, it refers to the number of data points input in a single packet loss rate calculation. For example... B With a packet loss rate of 32, the model can calculate the packet loss rate of 32 streams in a single prediction calculation. T This represents the time step length. H The dimension of the data.
[0030] In one implementation of this disclosure, the time step length is 2000 data packets, and the data dimension is 6, consisting of time offset value, SEQ, and ACK. 、 Direction, packet size, and whether a response was received.
[0031] Considering that packet loss can cause changes in the local features of the input data stream, this disclosure uses a block segmentation algorithm to enhance the model's ability to capture local features. First, the block length is determined. p and segmentation step size s In this patent p Selected as 50 data packets, s If 25 data packets are selected, the number of data blocks after segmentation can be determined according to formula (2). N The specific value.
[0032] (2) After determining the number of blocks, block length, and splitting step size s, the data is split along the time dimension, and the format of the split data is as follows: B x N x p x H Then, feature projection is performed according to formula (3).
[0033] (3) in, Indicates the input number of the first... i One data point, Flatten Indicates willp x H Data blocks are flattened into data dimensions D , Linear This represents a linear transformation, where the data format remains unchanged after the transformation, and the output is... The format remains the same. B x N x D .
[0034] Considering that subsequent multi-head attention mechanisms cannot directly obtain the location information of the data, and that the time offset value is different from the location information, a relative location information dimension is added to the data according to formula (4). After adding the dimension, the data becomes more dimensional. H It becomes 7-dimensional.
[0035] (4) in POS The absolute position of the data is represented by j, which represents any natural number, and d is the dimension of the position encoding.
[0036] Through the above operations, the data format becomes B x N x D , among which dimension D It includes relative information dimensions.
[0037] Step 3: Use the spatiotemporal feature extraction coding structure to extract features in time and space to obtain feature information.
[0038] After the data is segmented into blocks and relative positions are added, the data will be input into the spatiotemporal feature extraction coding structure, which includes a multi-head attention mechanism and a convolutional temporal structure.
[0039] The spatiotemporal feature extraction coding structure processes the data as follows: First, the data in each data block is fed into a multi-head attention mechanism to extract the packet loss feature relationships within it.
[0040] The multi-head attention mechanism of the scheme disclosed herein includes: a global attention mechanism, and other attention mechanisms, including: a long-delay attention mechanism and / or an attention mechanism where SEQ is not responded to.
[0041] Because the attention mechanism captures semantic information with a certain degree of randomness, multiple self-attention mechanisms are combined to compute semantic information from multiple perspectives, and this mechanism is called the multi-head attention mechanism.
[0042] Output matrix of multi-head attention mechanism The calculation formula is: (5) in, It is to each After concatenating matrices, connect them with the linking matrix. Multiply, Indicates the first The output of an attention mechanism is calculated using the following formula: (6) Considering that the packet loss judgment methods in the standard TCP protocol stack can still be used as judgment criteria in some cases, this disclosure applies a multi-head attention mechanism to the scheme of this disclosure, taking into account the specific application scenario of packet loss rate calculation. Figure 3 As shown. Long-latency attention includes the time query vector Q and the direction key vector. K and direction value vector V If SEQ does not respond, attention is primarily focused on the relationship between SEQ, ACK, direction, and count.
[0043] The standard protocol indicates that there has been a prolonged period of no response. TCP The packet should be a lost packet, therefore an attention mechanism focusing on time and direction is added to emphasize capturing the time characteristics of message interaction in both directions; it is also known that if a packet is retransmitted multiple times without a response, it is a lost packet, therefore an attention mechanism is added... SEQ The unresponsive attention mechanism emphasizes the response relationship between captured packets and the number of retransmissions. Finally, the outputs of the three attention mechanisms are concatenated, enabling the model to simultaneously acquire the features captured by all three.
[0044] Through the aforementioned improvements and optimizations, compared to traditional multi-head attention mechanisms that only focus on global semantics, this method adds attention branches in the time and direction dimensions (such as long-delay attention) to adapt to the packet loss judgment rules of the TCP protocol stack. The model can capture packet loss under standard conditions through the long-delay attention mechanism and the SEQ non-response attention mechanism, while the model can still intelligently learn and capture non-standard packet loss by relying on the global attention mechanism.
[0045] Specifically, the calculation method for each head's attention mechanism is as follows: Figure 4 As shown.
[0046] Figure 4 middle, Represents matrix multiplication. , , These represent the query vector, key vector, and value vector, respectively, and their calculation formulas are as follows: (7) in, For the input matrix, , , All are weight matrices.
[0047] The output of the self-attention mechanism is... Figure 3 Attention matrix in The calculation formula is: (8) in, As a penalty factor, used to ensure and The product will not be too large.
[0048] Through the aforementioned improvements and optimizations, compared to attention mechanisms that only focus on global semantics, this method adds attention branches in the time and direction dimensions (such as long-delay attention) to adapt to the packet loss judgment rules of the TCP protocol stack. The model can capture packet loss under standard conditions through the long-delay attention mechanism and the SEQ non-response attention mechanism, while the model can still intelligently learn and capture unconventional packet loss by relying on the global attention mechanism.
[0049] The captured features are then input into a convolutional temporal network that filters implicit information to obtain the features of the data.
[0050] The information extracted by the multi-head attention mechanism will be partially forgotten or enhanced through a spatiotemporal convolutional model. The structure of this model is as follows: Figure 5 As shown.
[0051] Considering that this model will be applied to the field of communications, focusing on message data, the direction of the flow will greatly affect which data in the input data should be forgotten or enhanced. For example, downlink traffic is usually larger and does not require receiving much information from the client. Therefore, the SEQ value, which represents packet requests, is more important in the downlink flow, while the ACK value has a relatively smaller role. Conversely, the ACK value is more important, while the SEQ value has a smaller role.
[0052] In summary, by optimizing the model and making direction a key indicator of forgetting or reinforcement, the improved model structure is as follows: Figure 6 As shown.
[0053] In the improved network, the input data Data is first used to calculate the main branch prediction result main through a Linear structure, which can be expressed by the formula: This branch is mainly used for feature representation and prediction.
[0054] The input data is processed through independent linear layers and nonlinear activations (Tanh) to generate auxiliary features that complement the main branch. The alpha parameter is used to adjust the weight of the auxiliary branch to prevent it from excessively interfering with the main task.
[0055] The input data (Data) is used to generate a gate signal (range 0-1) through Linear Attention and the Sigmoid activation function, which can be expressed by the formula: It is used to dynamically adjust the fusion ratio between main branch information and auxiliary branch information.
[0056] Finally, the main branch information is either forgotten or reinforced through gating information centered on direction (gate), while the original information is supplemented using the aux branch. aux can be expressed by the formula: It retains the intelligent forgetting or reinforcement function of temporal convolutional networks, and the specific calculation formula is as follows: (9) In formula (9) This indicates element-wise multiplication, and the embedding of the Direction affects the gating weights.
[0057] In the formula, `main` represents the feature extraction result; `gate` represents the attention mechanism parameters obtained along the direction dimension. The point-to-point matrix multiplication of `gate` and `main` means that the feature extraction result is further filtered based on the flow direction, resulting in the forgetting or reinforcement of some important indicators. However, the forgetting or reinforcement process inevitably leads to the loss of some information. Therefore, based on the extracted features, the results of the `aux` branch are used to supplement the original information.
[0058] Through the above improvements and optimizations, compared with traditional convolutional temporal networks, this method adds gating units with prior knowledge, which reduces the learning cost of the model and improves the model's ability to extract features from messages from different directions.
[0059] Step 4: Block segmentation, decoding, and output of results. After the improved multi-head attention mechanism and convolutional temporal network, the data features have been sufficiently extracted. Since a block-segmentation algorithm is used, the current output only contains features within each block; therefore, a block decoder unit is needed to decode and obtain the global data dependency features. Considering that the algorithm is designed for edge devices, it is necessary to minimize computational resource consumption; therefore, only the features extracted from each block are considered. The packet loss rate is directly mapped to a scalar through a single-layer fully connected network, and its calculation formula is as follows: (10) in, Indicates the first i Packet loss rate of block data W This represents the weight shared by multiple blocks. Indicates from the first i Features extracted from each block Represents matrix multiplication. b This indicates an offset shared by multiple blocks.
[0060] Step 5: After completing feature decoding, the decoder unit maps the block features to scalar output through a fully connected layer. The final packet loss rate is obtained by weighted averaging of the results of each block.
[0061] The training process of the packet loss rate calculation model is as follows: The forward algorithm is used to input the raw data into the model, and the predicted value is obtained after the model's calculation.
[0062] The mean squared error function is used to calculate the difference between the predicted value and the true label in step (1).
[0063] Based on the difference values, the backpropagation algorithm is used to calculate the gradient of the loss function with respect to each parameter of the model through automatic differentiation.
[0064] Based on the calculated gradient, the weights and biases are adjusted using the ADMA algorithm until the prediction accuracy reaches the expected target or the loss converges. At this point, the training can be considered complete.
[0065] The packet loss rate calculation model is used as follows: After training is complete, a model with the same structure is created on the target edge node device. After importing the fixed weights, the packet loss rate can be calculated in real time.
[0066] Based on the above method, this disclosure also provides an apparatus corresponding to the above method, including: The acquisition unit is used to extract message features from the raw data that can be used to calculate the packet loss rate. The message features are selected through feature engineering and prior knowledge. A segmentation unit is used to segment and window the message stream data to obtain multiple data blocks; Encoding unit, used to add relative position encoding to each data block to represent the position of each abstracted data block; The calculation unit is used to input the message features, the size of the message stream data, the number of data blocks and the relative position encoding into the trained packet loss rate calculation model to obtain the packet loss rate. The trained packet loss rate calculation model includes a spatiotemporal feature extraction encoding structure and a decoder unit. The spatiotemporal feature extraction encoding structure includes a multi-head attention mechanism and a convolutional temporal structure connected to it. The multi-head attention mechanism includes an attention mechanism that focuses on global semantics. The spatiotemporal feature extraction coding structure is used to extract features from the input data block in both time and space to obtain the feature information of each data block. The decoder unit is used to project the hidden dimensions in the feature information back to obtain the features of the data, and calculate the packet loss rate based on the features of the data.
[0067] Furthermore, the multi-head attention mechanism also includes other attention mechanisms, namely: a time- and direction-focused attention mechanism and / or an attention mechanism where the SEQ is not responded to; wherein, the time- and direction-focused attention mechanism is used to emphasize the message interaction time characteristics of capturing two directions, and the SEQ is not responded to attention mechanism is used to emphasize the response relationship and retransmission number between captured packets; The spatiotemporal feature extraction coding structure also includes a splicing unit; The splicing unit is used to splice features captured by an attention mechanism that focuses on global semantics and features captured by other attention mechanisms.
[0068] Furthermore, message characteristics include: direction, ACK, SEQ, time offset value, and whether a response is received.
[0069] Based on the same inventive concept as the above-disclosed content, this disclosure also provides an electronic device, such as... Figure 7 As shown. An electronic device according to an embodiment of this disclosure includes at least one processor and at least one memory electrically connected to the processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method described above.
[0070] It should be noted that the electrical connection between the above-mentioned units does not necessarily mean the connection between lines. The indirect connection method can be applied to the embodiments of this disclosure as long as it achieves the purpose of this disclosure.
[0071] Based on the same inventive concept, this disclosure also provides a computer storage medium storing a computer program, which, when executed by a processor, implements the steps of the above method.
[0072] Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A method for calculating the packet loss rate of a device, characterized in that, include: The message features that can be used to calculate the packet loss rate are obtained from the raw data. These message features are selected through feature engineering and prior knowledge. The message stream data is segmented and windowed to obtain multiple data blocks; Add a relative position code to each data block to represent the position of each abstracted data block; The message features, the size of the message stream data, the number of data blocks, and the relative position encoding are input into the trained packet loss rate calculation model to obtain the packet loss rate. The trained packet loss rate calculation model includes a spatiotemporal feature extraction encoding structure and a decoder unit. The spatiotemporal feature extraction encoding structure includes a multi-head attention mechanism and a convolutional temporal structure connected to it. The multi-head attention mechanism includes an attention mechanism that focuses on global semantics. The spatiotemporal feature extraction coding structure is used to extract features from the input data block in both time and space to obtain the feature information of each data block. The decoder unit is used to project the hidden dimensions in the feature information back to obtain the features of the data, and calculate the packet loss rate based on the features of the data.
2. The method according to claim 1, characterized in that, The multi-head attention mechanism also includes other attention mechanisms, namely: a time- and direction-focused attention mechanism and / or an attention mechanism where the SEQ is not responded to; wherein, the time- and direction-focused attention mechanism is used to emphasize the message interaction time characteristics of capturing two directions, and the SEQ is not responded to attention mechanism is used to emphasize the response relationship and retransmission number between captured packets; The spatiotemporal feature extraction coding structure also includes a splicing unit; The splicing unit is used to splice features captured by an attention mechanism that focuses on global semantics and features captured by other attention mechanisms.
3. The method according to claim 1, characterized in that, The convolutional temporal structure includes a main branch, a first auxiliary branch, and a second auxiliary branch; The result of multiplying the output of the main branch element by element with the output of the second auxiliary branch is then added to the output of the first auxiliary branch. The main branch is a Linear structure, used for feature representation and prediction, and outputs the prediction results; The first auxiliary branch consists of a series of independent linear layers, nonlinear activation layers, and alpha parameter layers, which are used to generate auxiliary features that are complementary to the main branch by utilizing the captured features. The alpha parameter layer is used to adjust the weights of the auxiliary branch. The second auxiliary branch includes linear attention and an activation function, which are used to generate a gating signal using the captured features. This gating signal is used to dynamically adjust the fusion ratio between the prediction output of the main branch and the auxiliary features output of the auxiliary branch.
4. The method according to claim 1, characterized in that, The decoder unit specifically maps the feature information extracted from each data block directly to a scalar through a single-layer fully connected network. This scalar is the packet loss rate of that data block. The packet loss rate of the message stream data is obtained by weighted averaging of the packet loss rates of each data block.
5. The method according to any one of claims 1-4, characterized in that, The message characteristics include: direction, ACK, SEQ, time offset value, and whether it has been responded to.
6. A device for calculating packet loss rate, characterized in that, include: The acquisition unit is used to extract message features from the raw data that can be used to calculate the packet loss rate. The message features are selected through feature engineering and prior knowledge. A segmentation unit is used to segment and window the message stream data to obtain multiple data blocks; Encoding unit, used to add relative position encoding to each data block to represent the position of each abstracted data block; The calculation unit is used to input the message features, the size of the message stream data, the number of data blocks and the relative position encoding into the trained packet loss rate calculation model to obtain the packet loss rate. The trained packet loss rate calculation model includes a spatiotemporal feature extraction encoding structure and a decoder unit. The spatiotemporal feature extraction encoding structure includes a multi-head attention mechanism and a convolutional temporal structure connected to it. The multi-head attention mechanism includes an attention mechanism that focuses on global semantics. The spatiotemporal feature extraction coding structure is used to extract features from the input data block in both time and space to obtain the feature information of each data block. The decoder unit is used to project the hidden dimensions in the feature information back to obtain the features of the data, and calculate the packet loss rate based on the features of the data.
7. The apparatus according to claim 6, characterized in that, The multi-head attention mechanism also includes other attention mechanisms, namely: a time- and direction-focused attention mechanism and / or an attention mechanism where the SEQ is not responded to; wherein, the time- and direction-focused attention mechanism is used to emphasize the message interaction time characteristics of capturing two directions, and the SEQ is not responded to attention mechanism is used to emphasize the response relationship and retransmission number between captured packets; The spatiotemporal feature extraction coding structure also includes a splicing unit; The splicing unit is used to splice features captured by an attention mechanism that focuses on global semantics and features captured by other attention mechanisms.
8. The apparatus according to claim 6 or 7, characterized in that, The message characteristics include: direction, ACK, SEQ, time offset value, and whether it has been responded to.
9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-5.
10. A computer storage medium, characterized in that, The computer storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1-5.