A method, device and equipment for detecting flow safety of electric power Internet of Things equipment

By deploying pre-trained lightweight models and cloud threat traffic detection models on edge devices of the power Internet of Things, combined with support vector machines, the problem of traffic security detection of edge devices in the power Internet of Things environment is solved, and real-time identification and accurate threat detection are achieved. , which improves security.

CN118200046BActive Publication Date: 2024-08-27INFORMATION & COMM BRANCH OF STATE GRID JIANGSU ELECTRIC POWER +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410592013.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-14
Publication Date
2024-08-27
Estimated Expiration
2044-05-14

AI Technical Summary

Technical Problem

In the power IoT environment, methods for identifying unexpected attacks and managing common intrusions in huge data are still lacking, and the massive and heterogeneous characteristics of power IoT edge devices are not considered, making security detection difficult to achieve.

Method used

The original traffic is initially classified through the pre-trained lightweight model deployed on the edge device, and combined with the cloud-pretrained threat traffic detection model and support vector machine, potential threat detection of the power Internet of Things edge device traffic is achieved.

Benefits of technology

Real-time identification of threat traffic from power IoT edge devices is achieved, reducing the processing burden, improving identification accuracy, and providing timely response and repair measures through cloud-edge collaboration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118200046B
    Figure CN118200046B
Patent Text Reader

Abstract

The present invention discloses a method, device and equipment for detecting traffic security of electric power Internet of Things devices. The method is applied to the cloud, including: obtaining a preliminary classification result determined by an associated Internet of Things edge device based on the original traffic of the electric power Internet of Things; the preliminary classification result is obtained after the type of the original traffic of the electric power Internet of Things is identified by a pre-trained lightweight model deployed on the associated Internet of Things edge device; the preliminary classification result is classified based on the threat traffic detection model pre-trained on the cloud, the intermediate classification result is determined and input into a preset support vector machine for traffic threat prediction, and a potential threat detection result is obtained. Pre-classification is performed by the lightweight model deployed on the associated Internet of Things edge device, so that the cloud can identify the potential threat detection result for a small number of preliminary classification results, and through cloud-edge collaboration, the identification of threat traffic of the edge device of the electric power Internet of Things is realized, the processing burden is reduced, and the accuracy of identification is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet of Things security technology, and in particular to a method, device and equipment for detecting flow security of power Internet of Things equipment. Background Art

[0002] The widespread adoption of IoT technology has led to an increase in the number of connected devices, creating a huge network of interconnected systems. Against the backdrop of new power system construction, the grid has undergone profound changes. On the load side, the access subjects and access methods of the power information network on the load side of the power grid are more complex, and the number of access terminals, substation terminals, distribution terminals, marketing terminals and other terminals is also showing an explosive growth trend. At the same time, the interaction between different access subjects on the load side and the power grid business system has also changed from traditional one-way data collection to more frequent two-way interaction of data collection and load regulation control, and the sensitive information of the power grid in the data interaction content has increased. Therefore, the security issues of the power Internet of Things will gradually emerge, especially the edge terminals and their APPs in low-trust environments, which may be attacked by external attacks without being perceived, resulting in a decrease in the trust of the collected data.

[0003] Developing secure and robust intrusion detection systems for IoT networks is critical to ensuring the continued growth and success of the IoT industry. Intrusion detection systems are used to identify suspicious or malicious behavior in the network and play a vital role in maintaining the security and stability of IoT networks. By analyzing traffic and behavior patterns, intrusion detection systems can detect and respond to potential threats in real time, helping to prevent data breaches, network outages, and other security incidents.

[0004] However, under the current power Internet of Things, there is still a lack of methods to identify unexpected attacks, provide real-time solutions, and manage common intrusions in huge data, and the massive heterogeneous characteristics of the power Internet of Things edge devices are not taken into account. Summary of the invention

[0005] The present invention provides a method, device and equipment for detecting the flow security of electric power Internet of Things equipment, so as to implement the security detection of the flow of electric power Internet of Things edge equipment.

[0006] According to a first aspect of the present invention, a method for detecting traffic security of power Internet of Things devices is provided, which is applied in the cloud and includes:

[0007] Obtaining a preliminary classification result determined by an associated IoT edge device based on the original traffic of the power IoT; the preliminary classification result is obtained by performing type recognition on the original traffic of the power IoT through a pre-trained lightweight model deployed on the associated IoT edge device;

[0008] Classify the preliminary classification results based on the threat traffic detection model pre-trained in the cloud to determine an intermediate classification result;

[0009] The intermediate classification result is input into a preset support vector machine for traffic threat prediction to obtain the potential threat detection result of the associated IoT edge device.

[0010] According to a second aspect of the present invention, a flow safety detection device for electric power Internet of Things equipment is provided, comprising:

[0011] A result acquisition module is used to obtain a preliminary classification result determined by an associated IoT edge device based on the original traffic of the power IoT; the preliminary classification result is obtained by performing type recognition on the original traffic of the power IoT through a pre-trained lightweight model deployed on the associated IoT edge device;

[0012] A first determination module is used to classify the preliminary classification result based on the threat traffic detection model pre-trained in the cloud and determine an intermediate classification result;

[0013] The second determination module is used to input the intermediate classification result into a preset support vector machine for traffic threat prediction to obtain the potential threat detection result of the associated Internet of Things edge device.

[0014] According to a third aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0015] at least one processor; and

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the flow security detection method for electric power Internet of Things equipment described in any embodiment of the present invention.

[0018] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for detecting flow security of an electric power Internet of Things device as described in any embodiment of the present invention when executed.

[0019] The technical solution of the embodiment of the present invention is to obtain the preliminary classification result determined by the associated IoT edge device based on the original traffic of the power IoT; the preliminary classification result is obtained after the type of the original traffic of the power IoT is identified by the pre-trained lightweight model deployed on the associated IoT edge device; the preliminary classification result is classified based on the threat traffic detection model pre-trained on the cloud to determine the intermediate classification result; the intermediate classification result is input into the preset support vector machine for traffic threat prediction to obtain the potential threat detection result of the associated IoT edge device. The lightweight model deployed by the associated IoT edge device is used for pre-classification, so that the threat traffic detection model only classifies a small number of preliminary classification results, and the preset support vector machine is combined to identify the potential threat detection result, so as to realize the real-time identification of the threat traffic of the power IoT edge device. Most of the original traffic of the power IoT is processed at the edge device end, which reduces the processing burden and improves the accuracy of identification.

[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 This is a flow chart of a method for detecting flow security of electric power Internet of Things devices provided according to the first embodiment of the present invention;

[0023] Figure 2 This is a flow chart of a method for detecting flow security of electric power Internet of Things devices provided according to Embodiment 2 of the present invention;

[0024] Figure 3 This is a flowchart of a method for detecting flow security of an electric power Internet of Things device provided according to Embodiment 2 of the present invention;

[0025] Figure 4 This is a structural example diagram of an improved Transformer model in a method for detecting flow security of electric power Internet of Things devices provided in Embodiment 2 of the present invention;

[0026] Figure 5 This is a schematic diagram of the structure of a flow safety detection device for power Internet of Things equipment provided according to Embodiment 3 of the present invention;

[0027] Figure 6 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Embodiment 1

[0031] Figure 1 A flow chart of a method for detecting flow security of an electric power Internet of Things device is provided for the first embodiment of the present invention. This embodiment is applicable to situations where security detection is performed on an edge device of the Internet of Things that transmits data to the Internet of Things. The method can be performed by a flow security detection device for an electric power Internet of Things device. The flow security detection device for an electric power Internet of Things device can be implemented in the form of hardware and / or software. The flow security detection device for an electric power Internet of Things device can be configured in an electronic device.

[0032] like Figure 1 As shown, the method is applied in the cloud, including:

[0033] S110. Obtain a preliminary classification result determined by an associated IoT edge device based on the original traffic of the power IoT. The preliminary classification result is obtained by performing type recognition on the original traffic of the power IoT through a pre-trained lightweight model deployed on the associated IoT edge device.

[0034] In this embodiment, the associated IoT edge device can be understood as a device used to collect and pre-process the raw power flow data of different sensor devices under its management conditions. For example, the associated IoT edge device is a power transmission terminal, and the power transmission terminal collects the raw power flow data collected by sensors within a certain range managed by it. The raw power flow data can be understood as the unprocessed power IoT flow data summarized by the associated IoT edge device. The preliminary classification results can be understood as including a small amount of results classified as threat traffic and unknown traffic.

[0035] As a specific example, this method can be applied to a cloud-based IoT management platform, and each associated IoT edge device can access the cloud-based IoT management platform through an account, password, and APP.

[0036] It is important to know that the pre-trained lightweight model can be deployed in the associated IoT edge device in advance to perform real-time and preliminary classification of the original power flow data, and filter out the flow data classified as threat flow and unknown flow as the preliminary classification result. The processor in the associated IoT edge device can parse the original power flow data, map it to intermediate data that can be recognized and processed by the cloud processor of the cloud IoT management platform, and can use a preset communication protocol such as the MQTT protocol to communicate with the cloud IoT management platform, and transmit the processed intermediate data and preliminary classification results to the cloud IoT management platform.

[0037] Specifically, the cloud processor can obtain the preliminary classification results determined based on the original traffic of the power Internet of Things transmitted by the associated Internet of Things edge device.

[0038] S120, classify the preliminary classification results based on the threat traffic detection model pre-trained in the cloud, and determine the intermediate classification results.

[0039] In this embodiment, the threat traffic detection model pre-trained in the cloud can be understood as a model trained in the cloud for detecting and classifying malicious behaviors. Compared with the above-mentioned lightweight model, the model is more complex and the detection result is more accurate. The intermediate classification result can be understood as the output result of the threat traffic detection model pre-trained in the cloud.

[0040] Specifically, the cloud processor can input the preliminary classification results into the threat traffic detection model pre-trained on the cloud, wherein the preliminary classification results also include the original power traffic data corresponding to the classification, so as to classify the preliminary classification results again and determine the intermediate classification results based on the output results of the threat traffic detection model.

[0041] For example, in the electric power Internet of Things, the intermediate classification results may include two types of network threats and normal network traffic. The two types of network dangers are network threats that aim to destroy communication availability and network threats that aim to destroy data integrity. Network threats that aim to destroy communication availability can be specifically divided into denial of service (DoS) attacks and black hole attacks. Among them, DOS attacks are a type of resource exhaustion attack that uses defects in network protocols or edge device software to send a large number of useless requests to exhaust the bandwidth resources of the Internet of Things, making it impossible for the server or communication network to provide services normally. Black hole attacks are also called packet loss attacks. During an attack, the route that should continue to transmit data packets discards the data packets. Network threats that aim to destroy data integrity can be specifically divided into error data injection attack, man-in-the-middle attack, and replay attack. Among them, error data injection attack is to manipulate the system status evaluation results through error data, causing the power grid to malfunction; man-in-the-middle attack refers to the attacker invading and controlling the edge device to form a new communication node. The power grid status information sent to the control center may also be modified or deleted by the attacker, affecting the stability of the power Internet of Things; replay attack refers to the attacker obtaining the data information received by the destination host through eavesdropping or other illegal means, and continuously maliciously repeating such information. In the training stage, the training sample data can be labeled, and the labels of the sample data can be divided into DoS attack, black hole attack, error data injection attack, man-in-the-middle attack, replay attack, and normal network traffic. The output result of the threat traffic detection model obtained by training with the labeled sample data is one of the above six types. For example, the original power traffic data that has been screened as unknown traffic by the pre-trained lightweight model is input into the threat traffic detection model, and the output result obtained is the black hole attack class, that is, the intermediate classification result is the black hole attack class.

[0042] Exemplarily, the cloud-based pre-trained threat traffic detection model may be composed of a convolutional neural network (CNN) and an improved Transformer model.

[0043] Exemplarily, during the training phase, the convolutional neural network (CNN) of the training part consists of seven convolutional blocks, each of which contains its own convolutional layer and maximum pooling layer for reducing features. The maximum pooling layers in all seven blocks share the same parameters (stride = 2, padding = 0). The convolution kernel size within each convolutional block is set to 2, which is very beneficial for extracting local features from the input data, and the padding parameter is uniformly configured to 1. The parameters of each convolutional block are configured as follows. In the first convolutional block, the input channel of the convolutional layer is 1 and the output channel is 2. In the second convolutional block, the convolutional layer has 2 input channels and 4 output channels. Subsequently, the number of input channels of the convolutional layer in the subsequent block is twice that of the previous layer, and the number of output channels is also twice that of the previous layer. Use a convolutional neural network (CNN) to extract local features from the input power sample data. Assume that the shape of the network traffic event G in the power sample data is , where n is the number of features in G. Use a shape of (1, ), is the "length" of the convolution kernel, and the moving step is Considering that the convolution operation will reduce the dimension of the original feature vector, zero padding is performed on both ends of the data before convolution to minimize the potential loss of edge features. The padding process is as follows:

[0044]

[0045] After the padding operation, the shape of G becomes After padding, the convolution operation is continued. Each initial feature vector of each stride is convolved to produce the process value , that is, convolve the initial feature vector of each step to obtain the process value. This process can be explained by the following formula:

[0046]

[0047] here, and Respectively represent the wight parameter and bias vector of the convolution kernel, Represents a linear rectification function. After completing all strides of each convolution kernel, we obtain , that is, the feature vector obtained after each convolution kernel executes all steps, its shape is , for The length of The calculation of is shown in the following formula:

[0048]

[0049] Then, The experience shape is , is the “length” of the max pooling kernel, and the stride is The maximum pooling layer.

[0050] get The process is shown as follows: for The feature vector is obtained through the maximum pooling layer:

[0051]

[0052] After multiple layers of the same convolution operation, the convolution output result is obtained through G , and its mapping relationship is as follows:

[0053]

[0054] After CNN processing, the shape of the input data becomes , batch_size indicates the number of data samples used for training at a time.

[0055] The encoder part of the improved Transformer structure consists of two encoder layers, each of which contains a multi-head self-attention mechanism, a normalization layer, and a feed-forward fully connected layer with residual connections. The main purpose of the encoder is to capture the input data By applying the self-attention mechanism, the encoder can effectively The decoder part contains a fully connected layer whose output dimension matches the number of output channels of the CNN during the training phase. The improved decoder part eliminates the self-attention mechanism to avoid extracting information from the labels. Instead, it converts the features extracted from the encoder into a higher-level feature representation, reducing training parameters while better understanding the abstract features in the input data.

[0056] This part receives the feature information passed from the CNN part , and first perform position encoding processing on it. The following formula is obtained process, It is the feature vector obtained after G passes through the position encoder part.

[0057]

[0058] in, represents the vector corresponding to position r, containing the sine and cosine pairs of each frequency. a represents the control The integer value of the parity condition in num is equal to The characteristic dimension of Indicates the dimension to which each feature is deepened.

[0059] In the multi-head attention layer of the encoder part, Each feature in has three properties: ,in and is a learnable weight matrix. The features and attributes in are evenly mapped to multiple subspaces, where the following conditions are met: The query matrix Q maps the input sequence to the query subspace, producing a query vector ; The key matrix K maps the input sequence to the key subspace and obtains the key vector ; The value matrix V maps the input sequence to the value subspace, obtaining the value vector Here, numh represents the number of heads in the multi-head attention mechanism. Next, the attention weight of each head is calculated. For the jth head, the query vector is calculated and the key vector The similarity between Dimensions Scale the similarity, normalize the similarity using the normalized exponential function softmax function, and finally use the weighted average of the attention weights to get the output of the self-attention mechanism is the output of the self-attention mechanism of the i-th head:

[0060]

[0061] Combining the output of the self-attention mechanism of all heads, we get , To combine the results of the self-attention mechanism of all heads. So far, the encoder part has fully captured global and partial local features.

[0062]

[0063] The following formula shows Through the normalization layer The process:

[0064]

[0065] in, express The average value of express The standard deviation of . A residual connection is established in the multi-head attention layer, as shown in the following formula.

[0066]

[0067] here, Representative from arrive The mapping process, is the result of residual connection. Then, After the feed-forward fully connected layer and the normalization layer. In addition, a residual connection is established in the feed-forward fully connected layer, as shown in the following formula:

[0068]

[0069] in this case, Represents the completion of the fully connected layer and the normalization layer The mapping process is then forwarded to the decoder for further abstraction through the decoder's fully connected layer and partial feature dimensionality reduction, thereby reducing model training parameters. The result is then passed to the fully connected layer outside the decoder, and then classified using the softmax function.

[0070]

[0071] here, express The mapping process through the fully connected layer.

[0072] S130: Input the intermediate classification result into a preset support vector machine for traffic threat prediction to obtain potential threat detection results of associated IoT edge devices.

[0073] In this embodiment, the preset support vector machine (SVM) can be understood as a machine learning method for predicting whether there is a threat. The preset SVM is a prior art, so its structure is not described here. The potential threat detection result can be understood as a method for characterizing whether there is a potential threat in the power Internet of Things flow data.

[0074] Specifically, the cloud processor can input the intermediate classification results into a preset support vector machine for traffic threat prediction, and obtain the potential threat detection results of the associated IoT edge devices based on the output results of the preset support vector machine.

[0075] For example, SVM uses the decision function Generate a score vector for each category, where O represents the output of the trained cloud pre-trained part: .here, and Represent the weight parameter and bias value respectively, and P represents the intermediate classification result. The argmax function is introduced to obtain the potential threat detection result, which is expressed as pred. The potential threat detection result is determined by the following formula:

[0076]

[0077] The technical solution of the embodiment of the present invention is to obtain the preliminary classification result determined by the associated IoT edge device based on the original traffic of the power IoT; the preliminary classification result is obtained after the type of the original traffic of the power IoT is identified by the pre-trained lightweight model deployed on the associated IoT edge device; the preliminary classification result is classified based on the threat traffic detection model pre-trained on the cloud to determine the intermediate classification result; the intermediate classification result is input into the preset support vector machine for traffic threat prediction to obtain the potential threat detection result of the associated IoT edge device. By pre-classifying the lightweight model deployed on the associated IoT edge device, the cloud can classify only a small number of preliminary classification results through the threat traffic detection model, and identify the potential threat detection results in combination with the preset support vector machine. Through cloud-edge collaboration, real-time identification of threat traffic of the power IoT edge device is achieved, and most of the original traffic of the power IoT is processed on the edge device side, which reduces the processing burden and improves the accuracy of identification.

[0078] As a first optional embodiment of the first embodiment, after the intermediate classification result is input into a preset support vector machine for traffic threat prediction and a potential threat detection result of an associated IoT edge device is obtained, it also includes:

[0079] The potential threat detection results are fed back to the associated IoT edge devices so that the associated IoT edge devices can respond to and repair the potential threat detection results.

[0080] Specifically, the cloud processor can feed back the potential threat detection results to the associated IoT edge devices. After receiving the potential threat detection results, the associated IoT edge devices will respond to the threats accordingly. The associated IoT edge devices can reduce the impact of the threats by isolating the infected terminal devices, removing malware, blocking network connections, etc. The infected terminal devices can be repaired, security policies and rules updated, and threat intelligence shared to avoid being attacked by similar threats again.

[0081] In the first optional embodiment of the first embodiment, the threat detection result is fed back to the associated IoT edge device to trigger it to automatically respond and repair, thereby achieving a timely response to the threat and reducing the impact of the threat.

[0082] Embodiment 2

[0083] Figure 2 This is a flow chart of a method for detecting flow security of power Internet of Things devices provided in the second embodiment of the present invention. This embodiment is a further refinement of the above embodiment. Figure 2 As shown, the method includes:

[0084] S201. Obtain preliminary classification results determined by the associated IoT edge device based on the original traffic of the power IoT.

[0085] S202. Perform local feature extraction on the preliminary classification results based on the preset convolutional neural network in the threat traffic detection model pre-trained in the cloud to obtain local feature results.

[0086] In this embodiment, the preset convolutional neural network can be understood as a trained CNN network. The local feature result can be understood as the output result of the CNN network, which is used to characterize the local characteristics contained in the input data.

[0087] Specifically, the cloud processor can input the preliminary classification results into the threat traffic detection model pre-trained in the cloud, fill the two ends of the original power flow data in the preliminary classification results with zeros through a preset convolutional neural network, and perform operations based on the trained convolutional layer and pooling layer to extract local features of the preliminary classification results to obtain local feature results. The specific steps can refer to step S120.

[0088] S203: Position-encode the local feature results based on the threat traffic detection model to obtain a position-encoded result.

[0089] In this embodiment, the position encoding result can be understood as a result containing global features.

[0090] Specifically, the cloud processor can position encode the local feature results based on the threat traffic detection model to obtain a position encoding result. The position encoding can be processed by a position encoder in the prior art, and the position encoding step recorded in step S120 can be referred to, so it will not be repeated here.

[0091] S204. Process the position encoding result based on the improved Transformer model in the threat traffic detection model to obtain a decoding result.

[0092] In this embodiment, the improved Transformer model can be understood as an improved model for classification, and the structure of the improved Transformer model includes a multi-layer encoder and a decoder, and the present application adopts a two-layer encoder. The decoding result can be understood as the result after decoding by the improved Transformer model.

[0093] Specifically, the position encoding result can be processed based on the two-layer encoder and decoder in the improved Transformer model in the threat traffic detection model to obtain a decoding result.

[0094] Furthermore, the improved Transformer model includes a set number of preset encoders and preset decoders. Accordingly, the position encoding result is processed based on the improved Transformer model in the threat traffic detection model to obtain a decoding result, including:

[0095] The multi-head attention layer based on the preset encoder performs multi-head processing on the position encoding result to determine the multi-head self-attention output result; the multi-head self-attention output result is processed based on the first normalization layer of the preset encoder to obtain a normalized result; the normalized result is residually connected based on the preset encoder to obtain a residual connection result; the residual connection result is processed based on the second normalization layer in the preset encoder and the feedforward fully connected layer that establishes the residual connection to obtain the final encoding result; the final encoding result is decoded layer by layer according to the fully connected layer of the preset decoder to obtain a decoding result.

[0096] In this embodiment, the structure of the preset encoder may include a multi-head attention layer, a first normalization layer, a feedforward fully connected layer and a second normalization layer, wherein the first normalization layer and the second normalization layer have the same structure and both include residual connections and normalization. The multi-head self-attention output result can be understood as the result output after being processed by the multi-head attention layer. The normalized result can be understood as the result after normalization processing. The residual connection result can be understood as the result after establishing a residual connection for the multi-head self-attention output result. The final encoding result can be understood as the result after being processed by the preset encoder.

[0097] Specifically, the multi-head attention layer based on the preset encoder performs multi-head processing on the position encoding result to obtain the query vector, key vector and value vector mapped by the position encoding result. For each self-attention head, the similarity between the query vector and the value vector is calculated, the similarity is scaled by the dimension of the key vector, and the scaled similarity is normalized by the softmax function. Finally, the weighted average of the attention weight calculation value is used to determine the multi-head self-attention output result. This step can refer to step S120. The multi-head self-attention output result is processed based on the first normalization layer of the preset encoder to obtain a normalized result, and the normalized result is residually connected based on the preset encoder to obtain a residual connection result. The residual connection result is processed based on the feedforward fully connected layer that establishes the residual connection in the preset encoder, and the processed result is normalized by the second normalization layer to obtain the final encoding result. The final encoding result is passed to the fully connected layer of the preset decoder for layer-by-layer decoding to obtain a decoding result.

[0098] S205: Process the decoding result according to the linear regression layer in the threat traffic detection model to obtain a regression result.

[0099] In this embodiment, the linear regression layer can be understood as a regression analysis method for modeling the relationship between one or more independent variables and a dependent variable through the least square function of the linear regression equation, which is a prior art and will not be described in detail. The regression result can be understood as the result after being processed by the linear regression layer.

[0100] Specifically, the cloud processor can input the decoding result into the linear regression layer in the threat traffic detection model for processing to obtain a regression result.

[0101] S206: Process the regression result according to the normalized exponential function in the threat traffic detection model to obtain an intermediate classification result.

[0102] In this embodiment, the normalized exponential function can be understood as being used to perform , that is, a softmax function.

[0103] Specifically, the regression result is processed according to the normalized exponential function in the threat traffic detection model to obtain an intermediate classification result.

[0104] For example, in order to facilitate understanding of the structure of the improved Transformer model in this application, a specific example is used for demonstration. Figure 4 This is a structural example diagram of an improved Transformer model in a method for detecting flow security of an electric power Internet of Things device provided in Embodiment 2 of the present invention, such as Figure 4 As shown in the figure, the improved Transformer model connects two preset encoders through the position encoding algorithm, connects the preset decoder through the two preset encoders, connects the linear regression algorithm through the preset encoder, and connects the softmax function through the linear regression algorithm to obtain the intermediate classification result. Each preset encoder includes a multi-head attention layer, a first normalization layer (residual connection and normalization layer), a feedforward fully connected layer, and a second normalization layer (residual connection and normalization layer). The preset decoder performs layer-by-layer decoding to obtain the sub-decoding results of each layer. , n is the total number of features in the local feature results from CNN, and the decoded data is input to the linear regression layer. Among them, the parameters in the preset encoder are Set to 200, which is the same as the position encoder The parameters are the same; the nhead parameter is set to 2, indicating that there are 2 parallel heads in the multi-head attention layer, extracting features from the input data at the same time; the nhid parameter is set to 2, indicating that the entire encoder consists of two encoder layers; the dropout parameter is set to 0.2 to ensure that the overall framework is not overfitted as much as possible. The fully connected layer of the preset decoder has an input feature dimension of 200 and an output feature dimension of 128, denoted as in_features and out_features respectively. After the decoder part, the shape of the input data becomes (128, 128). The fully connected layer part consists of a total of five layers. The parameters of the first fully connected layer: the value of in_features is 128×128, and the value of out_features is 1000. The in_features of the second layer is 1000, and the out_features is 500. In the third layer, the in_features parameter is set to 500, and the out_features parameter is set to 200. For the fourth layer, in_features is 200 and out_features is 50. Finally, in the fifth layer, in_features is 50 and out_features is 10; here, 10 represents the number of classes for the initial classification. The activation function used in the first four layers is ReLU, and the activation function used in the last layer is softmax.

[0105] S207: Input the intermediate classification result into a preset support vector machine for traffic threat prediction to obtain potential threat detection results of associated IoT edge devices.

[0106] The technical solution of the embodiment of the present invention is to extract local features of the preliminary classification results through the preset convolutional neural network in the threat traffic detection model pre-trained in the cloud, obtain local feature results, and position encode the local feature results to obtain position encoding results, and then encode the position encoding results by applying the self-attention mechanism through the encoder in the improved Transformer model to capture the global and partial local features in the position encoding results, and finally connect them through the preset decoder to obtain the decoding results. The linear regression layer and the normalized exponential function in the threat traffic detection model process the encoding results in sequence to obtain the intermediate classification results finally output by the threat traffic detection model, and input the intermediate classification results into the preset support vector machine for traffic threat prediction to obtain the potential threat detection results of the associated IoT edge devices. The identification of threat traffic is realized, the accuracy of the threat traffic detection model is improved, and the accuracy of identification is improved.

[0107] For the sake of illustrative purposes, a specific example is used to illustrate the present invention. Figure 3A flow chart of a method for detecting flow security of power Internet of Things devices provided in the second embodiment of the present invention is shown as follows: Figure 3 As shown, it can include two execution entities, namely, an associated IoT edge device and a cloud IoT management platform including a cloud-based pre-trained threat traffic detection model and a preset support vector machine. First, the original traffic of the power IoT can be processed by the pre-trained lightweight model in the associated IoT edge device to obtain a preliminary classification result and transmit it to the cloud IoT management platform. It is processed by a preset convolutional neural network and an improved Transformer model to obtain an intermediate classification result, and then processed by a preset support vector machine to obtain a potential threat detection result, which is finally fed back to the associated IoT edge device to respond to and repair the potential threat traffic.

[0108] As a first optional embodiment of the second embodiment, based on the above embodiment, the training steps of the pre-trained lightweight model include:

[0109] Among them, the pre-trained lightweight model can be trained in the cloud or in the associated IoT edge devices.

[0110] a1. Obtain the pre-trained power IoT traffic sample set.

[0111] In this embodiment, the pre-trained electric power Internet of Things traffic sample set can be understood as a collection of a large number of electric power Internet of Things traffic samples with added category labels for model training.

[0112] Specifically, the historically acquired power Internet of Things traffic data can be annotated manually or by machine to form a pre-trained power Internet of Things traffic sample set and send it to the processor, and the processor can obtain the pre-trained power Internet of Things traffic sample set.

[0113] b1. Use the pre-trained threat traffic detection model on the cloud as the teacher model.

[0114] In this embodiment, the teacher model can be understood as a model for the student model to imitate.

[0115] c1. Use the one-dimensional preset convolutional neural network and the improved Transformer model in the threat traffic detection model as student models.

[0116] In this embodiment, the one-dimensional preset convolutional neural network can be understood as a preset convolutional neural network that only includes one dimension.

[0117] Specifically, since the student model needs to be lightweight, the processor can retain the one-dimensional preset convolutional neural network CNN and the one-dimensional improved Transformer model in the threat traffic detection model as the student model.

[0118] d1. Determine the focus level information under each category based on the pre-trained power Internet of Things traffic sample set and the preset softening weight distribution parameters.

[0119] In this embodiment, the preset softening weight distribution parameter can be understood as a parameter used to control the softening target weight distribution. The focus level information can be understood as information used to control the focus level of each category to prevent excessive focus on infrequent categories and thus cause low accuracy.

[0120] Specifically, in order to solve the problem of category imbalance, the cloud processor can determine the focus level information under each category based on the overall sample information belonging to each category in the pre-trained power Internet of Things traffic sample set combined with the preset softened weight distribution parameters.

[0121] Further, based on the above embodiment, the steps of determining the focus level information under each category according to the pre-trained power Internet of Things traffic sample set and the preset softening weight distribution parameters can be refined as follows:

[0122] Based on the category frequency and sample size of each category in the pre-trained power IoT traffic sample set combined with the preset softened weight distribution parameters, the focus level information ɑ under each category is determined by the following formula i :

[0123]

[0124] in, represents the category frequency of category i in the pre-trained power IoT traffic sample set, represents the sample size of category i, represents the preset softening weight distribution parameter, D represents the number of categories, Set to 2.

[0125] e1. Train the student model based on the pre-trained power Internet of Things traffic sample set, the preset knowledge distillation algorithm, the information of each focus level and the teacher model to determine the pre-trained lightweight model.

[0126] In this embodiment, the preset knowledge distillation algorithm can be understood as an algorithm for using the predicted category probability of the teacher model as an optimization guide for the student model, and can be a preset knowledge distillation algorithm that combines the distillation temperature with the softmax function.

[0127] Specifically, the processor can input the power Internet of Things traffic samples in the pre-trained power Internet of Things traffic sample set into the student model and the teacher model respectively, and obtain the output of the fully connected layer of the student model and the teacher model. According to the output of the fully connected layer of the student model and the teacher model combined with the preset knowledge distillation algorithm, the probability results of the student model and the teacher model can be determined, and then combined with the focus level information under each category, the total loss function is determined, and the student model is trained through the total loss function to obtain a pre-trained lightweight model.

[0128] Further, based on the above embodiment, the steps of training the student model according to the pre-trained power Internet of Things traffic sample set, the preset knowledge distillation algorithm, each focus level information and the teacher model to determine the pre-trained lightweight model can be refined as follows:

[0129] e11. Input the power Internet of Things traffic samples in the pre-trained power Internet of Things traffic sample set into the teacher model and the student model respectively to obtain the output results of the teacher's fully connected layer and the output results of the student's fully connected layer.

[0130] In this embodiment, the power Internet of Things traffic sample can be understood as the power Internet of Things traffic sample that has been labeled. The output result of the teacher's fully connected layer can be understood as the result output by the fully connected layer in the teacher model. The output result of the student's fully connected layer can be understood as the result output by the fully connected layer in the student model.

[0131] Specifically, the processor can input the power Internet of Things traffic samples in the pre-trained power Internet of Things traffic sample set into the teacher model and the student model respectively, and after processing by the teacher model and the student model, obtain the output results of the teacher model's fully connected layer and the output results of the student model's fully connected layer, that is, obtain the output results of the teacher's fully connected layer and the output results of the student's fully connected layer.

[0132] e12. Determine the teacher's prediction results and the student's prediction results based on the teacher's fully connected layer output results, the student's fully connected layer output results and the preset knowledge distillation algorithm.

[0133] In this embodiment, the teacher prediction result can be understood as the classification result of the teacher model, and the student prediction result can be understood as the classification result of the student model.

[0134] Specifically, the processor can use a preset knowledge distillation algorithm to combine the output results of the teacher's fully connected layer with the output results of the student's fully connected layer, so that the student model imitates the final prediction of the teacher model to obtain the teacher's prediction results and the student's prediction results.

[0135] Exemplarily, the preset knowledge distillation algorithm may be:

[0136]

[0137] in, represents the result of distillation, represents the fully connected layer output result logits of the i-th category, T represents the distillation temperature that can soften the predicted distribution, and T is set in the range of 2.5 to 4.

[0138] e13. Determine the total loss function based on the information of each focus level, the student prediction results, the teacher prediction results and the preset modulation level factor.

[0139] Specifically, the processor can determine the hard loss function through each focus level information, preset modulation level factor and student prediction results, and determine the soft loss function through the teacher prediction results and the student prediction results.

[0140] e14. Train the student model according to the total loss function to obtain a pre-trained lightweight model.

[0141] Among them, based on the above embodiment, according to each focus level information, student prediction results, teacher prediction results and preset modulation level factors, a total loss function is determined, including:

[0142] The hard loss function is determined based on the information of each focus level, the student prediction results, the preset modulation level factor and the actual distribution in the power Internet of Things traffic sample; the soft loss function is determined based on the teacher's prediction results and the student's prediction results combined with the divergence loss function; the total loss function is determined based on the hard loss function, the soft loss function and the preset variable factors.

[0143] In this embodiment, the true distribution can be understood as the true probability distribution of the category in the power Internet of Things traffic sample. The hard loss function can be understood as the loss function related to the prediction result of the student model. The soft loss function can be understood as the loss function used to optimize the student logits to the teacher logits. The preset variable factor can be understood as the variable factor used to dynamically adjust the distillation loss.

[0144] Specifically, the processor can determine the hard loss function based on the information of each focus level, the teacher's prediction results, the preset modulation level factor and the actual distribution in the power Internet of Things traffic samples.

[0145] Exemplary, hard loss function It can be calculated by the following formula:

[0146]

[0147] in, represents the teacher's predicted probability distribution, which is the correct predicted probability distribution output by the teacher model, and y represents the true distribution. ) represents the probability of misclassified samples, Indicates the preset modulation level factor. Can be set to 2.

[0148] Specifically, the processor may determine the soft loss function based on the teacher's prediction results and the student's prediction results in combination with the divergence loss function.

[0149] Exemplary, soft loss function It can be determined by the following formula:

[0150]

[0151] in, and Represents teacher logits and student logits, L KL () represents the KullbackLeibler divergence loss function. is the teacher prediction result of the teacher model. is the student's prediction result. The optimization of can gradually make the student logits match the teacher logits.

[0152] Specifically, the cloud processor can determine the total loss function based on the hard loss function, the soft loss function and the preset variable factors.

[0153] Exemplarily, the total loss function can be determined by the following formula: :

[0154]

[0155] in, is a preset variable factor. For the parameters in the knowledge distillation process, Set it in the range of 0.1 to 0.3.

[0156] In the first optional embodiment of the second embodiment, the threat traffic detection model pre-trained in the cloud is used as the teacher model, and the one-dimensional structure is extracted from the threat traffic detection model pre-trained in the cloud as the student model. The predicted category probability of the teacher model is used as a soft target to guide the optimization direction of the student model by using knowledge distillation. By pre-training the category frequency meter category sample size under each category in the power Internet of Things traffic sample set combined with the preset softening weight distribution parameter, the focus level information under each category is determined, and the problem of category imbalance in the sample is solved. The pre-trained samples are optimized by focusing on the level information, which lays the foundation for model training. On the basis of the cross entropy loss, the preset modulation level factor and the focus level information are added, thereby determining the hard loss function to adapt to the unbalanced distribution problem of network attack samples in the power Internet of Things network traffic anomaly detection task. The output result of the student's fully connected layer is more matched with the output result of the teacher's fully connected layer through the optimization of the soft loss function. The student model is trained by determining the total loss function through the soft loss function, the hard loss function and the preset variable factor to obtain a pre-trained lightweight model, thereby improving the accuracy of the lightweight model.

[0157] Embodiment 3

[0158] Figure 5 This is a schematic diagram of the structure of a flow safety detection device for power Internet of Things equipment provided by the third embodiment of the present invention. Figure 5 As shown, the device comprises:

[0159] A result acquisition module 51 is used to obtain a preliminary classification result determined by an associated IoT edge device based on the power IoT original traffic; the preliminary classification result is obtained by performing type recognition on the power IoT original traffic through a pre-trained lightweight model deployed on the associated IoT edge device;

[0160] A first determination module 52, configured to classify the preliminary classification result based on a threat traffic detection model pre-trained in the cloud, and determine an intermediate classification result;

[0161] The second determination module 53 is used to input the intermediate classification result into a preset support vector machine for traffic threat prediction to obtain the potential threat detection result of the associated IoT edge device.

[0162] The technical solution of the embodiment of the present invention is to obtain the preliminary classification result determined by the associated IoT edge device based on the original traffic of the power IoT; the preliminary classification result is obtained after the type of the original traffic of the power IoT is identified by the pre-trained lightweight model deployed on the associated IoT edge device; the preliminary classification result is classified based on the threat traffic detection model pre-trained on the cloud to determine the intermediate classification result; the intermediate classification result is input into the preset support vector machine for traffic threat prediction to obtain the potential threat detection result of the associated IoT edge device. Pre-classification is performed by the lightweight model deployed on the associated IoT edge device, and the cloud classifies only a small number of preliminary classification results through the threat traffic detection model, and combines the preset support vector machine to identify the potential threat detection results. Through cloud-edge collaboration, real-time identification of threat traffic of the power IoT edge device is achieved, and most of the original traffic of the power IoT is processed on the edge device side, which reduces the processing burden and improves the accuracy of identification.

[0163] Further, the first determining module 52 includes:

[0164] A first determination unit is used to extract local features from the preliminary classification results based on a preset convolutional neural network in a threat traffic detection model pre-trained in the cloud to obtain a local feature result;

[0165] A second determining unit is used to perform position encoding on the local feature result based on the threat traffic detection model to obtain a position encoding result;

[0166] A third determining unit is used to process the position encoding result based on the improved Transformer model in the threat traffic detection model to obtain a decoding result;

[0167] a fourth determining unit, configured to process the decoding result according to a linear regression layer in the threat traffic detection model to obtain a regression result;

[0168] The fifth determining unit is used to process the regression result according to the normalized exponential function in the threat traffic detection model to obtain an intermediate classification result.

[0169] The improved Transformer model includes a set number of preset encoders and preset decoders, and accordingly, the third determination unit is specifically used to:

[0170] Performing multi-head processing on the position encoding result based on the multi-head attention layer of the preset encoder to determine the multi-head self-attention output result;

[0171] Processing the multi-head self-attention output result based on the first normalization layer of the preset encoder to obtain a normalized result;

[0172] Performing residual connection on the normalized result based on the preset encoder to obtain a residual connection result;

[0173] Processing the residual connection result based on the second normalization layer in the preset encoder and the feedforward fully connected layer for establishing the residual connection to obtain a final encoding result;

[0174] The final encoding result is decoded layer by layer according to the fully connected layer of the preset decoder to obtain a decoding result.

[0175] Optionally, the device also includes: a model training module.

[0176] Furthermore, the model training module includes:

[0177] A sample set acquisition unit, used to acquire a pre-trained electric power Internet of Things traffic sample set;

[0178] a sixth determination unit, configured to use a threat traffic detection model pre-trained in the cloud as a teacher model;

[0179] A seventh determination unit, configured to use the one-dimensional preset convolutional neural network and the improved Transformer model in the threat traffic detection model as student models;

[0180] An information determination unit, used to determine the focus level information under each category according to the pre-trained power Internet of Things traffic sample set and the preset softening weight distribution parameters;

[0181] A model determination unit is used to train the student model according to the pre-trained power Internet of Things traffic sample set, the preset knowledge distillation algorithm, the focus level information and the teacher model to determine the pre-trained lightweight model.

[0182] The information determination unit is specifically used for:

[0183] Based on the category frequency of each category in the pre-trained power Internet of Things traffic sample set and the sample size of each category combined with the preset softened weight distribution parameters, the focus level information under each category is determined by the following formula :

[0184]

[0185] in, represents the category frequency of category i in the pre-trained power IoT traffic sample set, represents the sample size of category i, represents the preset softening weight distribution parameter, and D represents the number of categories.

[0186] Wherein, the model determination unit includes:

[0187] A first determination subunit is used to input the power Internet of Things traffic samples in the pre-trained power Internet of Things traffic sample set into the teacher model and the student model respectively to obtain the teacher fully connected layer output result and the student fully connected layer output result;

[0188] A second determination subunit is used to determine the teacher prediction result and the student prediction result according to the teacher fully connected layer output result, the student fully connected layer output result and the preset knowledge distillation algorithm;

[0189] A third determination subunit is used to determine a total loss function according to each of the focus level information, the student prediction result, the teacher prediction result and a preset modulation level factor;

[0190] The fourth determination subunit is used to train the student model according to the total loss function to obtain a pre-trained lightweight model.

[0191] The third determining subunit is specifically used for:

[0192] Determine a hard loss function according to each of the focus level information, the teacher prediction result, the preset modulation level factor and the real distribution in the electric power Internet of Things traffic sample;

[0193] Determine a soft loss function based on the teacher prediction result and the student prediction result combined with a divergence loss function;

[0194] A total loss function is determined according to the hard loss function, the soft loss function and a preset variable factor.

[0195] Optionally, the device further comprises:

[0196] The second determination module is used to input the intermediate classification result into a preset support vector machine for traffic threat prediction to obtain the potential threat detection result of the associated Internet of Things edge device, and then feed back the potential threat detection result to the associated Internet of Things edge device, so that the associated Internet of Things edge device responds to and repairs the potential threat detection result.

[0197] The power Internet of Things device flow security detection device provided in the embodiment of the present invention can execute the power Internet of Things device flow security detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0198] Embodiment 4

[0199] Figure 6A schematic diagram of an electronic device 60 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0200] like Figure 6 As shown, the electronic device 60 includes at least one processor 61, and a memory connected to the at least one processor 61 in communication, such as a read-only memory (ROM) 62, a random access memory (RAM) 63, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 61 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 62 or the computer program loaded from the storage unit 68 to the random access memory (RAM) 63. In the RAM 63, various programs and data required for the operation of the electronic device 60 can also be stored. The processor 61, the ROM 62, and the RAM 63 are connected to each other via a bus 64. An input / output (I / O) interface 65 is also connected to the bus 64.

[0201] A number of components in the electronic device 60 are connected to the I / O interface 65, including: an input unit 66, such as a keyboard, a mouse, etc.; an output unit 67, such as various types of displays, speakers, etc.; a storage unit 68, such as a disk, an optical disk, etc.; and a communication unit 69, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 69 allows the electronic device 60 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0202] The processor 61 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 61 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 61 executes the various methods and processes described above, such as a method for detecting flow security of an electric power IoT device.

[0203] In some embodiments, the power Internet of Things device flow security detection method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 68. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 60 via the ROM 62 and / or the communication unit 69. When the computer program is loaded into the RAM 63 and executed by the processor 61, one or more steps of the power Internet of Things device flow security detection method described above can be performed. Alternatively, in other embodiments, the processor 61 can be configured to execute the power Internet of Things device flow security detection method in any other appropriate manner (for example, by means of firmware).

[0204] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0205] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0206] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0207] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0208] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0209] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0210] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0211] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for detecting flow security of electric power Internet of Things equipment, characterized in that: Applied in the cloud, including: Obtaining a preliminary classification result determined by an associated IoT edge device based on the original traffic of the power IoT; the preliminary classification result is obtained by performing type recognition on the original traffic of the power IoT through a pre-trained lightweight model deployed on the associated IoT edge device; Classify the preliminary classification results based on the threat traffic detection model pre-trained in the cloud to determine an intermediate classification result; Input the intermediate classification result into a preset support vector machine for traffic threat prediction to obtain a potential threat detection result of the associated IoT edge device; The training steps of the pre-trained lightweight model include: Obtain a pre-trained power IoT traffic sample set; Use the threat traffic detection model pre-trained in the cloud as the teacher model; The one-dimensional preset convolutional neural network and the improved Transformer model in the threat traffic detection model are used as student models; Determine the focus level information under each category according to the pre-trained electric power Internet of Things traffic sample set and the preset softening weight distribution parameters; The student model is trained according to the pre-trained electric power Internet of Things traffic sample set, the preset knowledge distillation algorithm, each of the focus level information and the teacher model to determine the pre-trained lightweight model; Wherein, determining the focusing level information under each category according to the pre-trained electric power Internet of Things traffic sample set and the preset softening weight distribution parameters includes: Based on the category frequency of each category in the pre-trained power Internet of Things traffic sample set and the sample size of each category combined with the preset softened weight distribution parameters, the focus level information under each category is determined by the following formula : ; in, Represents the categories in the pre-trained power IoT traffic sample set i The frequency of the categories, Indicates category i The sample size is represents the preset softening weight distribution parameter, D Indicates the number of categories.

2. The method according to claim 1, characterized in that The threat traffic detection model based on cloud pre-training classifies the preliminary classification result to determine the intermediate classification result, including: Extracting local features from the preliminary classification results based on a preset convolutional neural network in a threat traffic detection model pre-trained in the cloud to obtain local feature results; Performing position encoding on the local feature result based on the threat traffic detection model to obtain a position encoding result; Processing the position encoding result based on the improved Transformer model in the threat traffic detection model to obtain a decoding result; Processing the decoding result according to the linear regression layer in the threat traffic detection model to obtain a regression result; The regression result is processed according to the normalized exponential function in the threat traffic detection model to obtain an intermediate classification result.

3. The method according to claim 2, characterized in that The improved Transformer model includes a set number of preset encoders and preset decoders. Accordingly, the improved Transformer model based on the threat traffic detection model processes the position encoding result to obtain a decoding result, including: Performing multi-head processing on the position encoding result based on the multi-head attention layer of the preset encoder to determine the multi-head self-attention output result; Processing the multi-head self-attention output result based on the first normalization layer of the preset encoder to obtain a normalized result; Performing residual connection on the normalized result based on the preset encoder to obtain a residual connection result; Processing the residual connection result based on the second normalization layer in the preset encoder and the feedforward fully connected layer for establishing the residual connection to obtain a final encoding result; The final encoding result is decoded layer by layer according to the fully connected layer of the preset decoder to obtain a decoding result.

4. The method according to claim 1, characterized in that: The method of training the student model according to the pre-trained electric power Internet of Things traffic sample set, the preset knowledge distillation algorithm, each of the focus level information and the teacher model to determine the pre-trained lightweight model includes: Inputting the electric power Internet of Things traffic samples in the pre-trained electric power Internet of Things traffic sample set into the teacher model and the student model respectively, and obtaining the teacher fully connected layer output result and the student fully connected layer output result; Determine the teacher prediction result and the student prediction result according to the teacher fully connected layer output result, the student fully connected layer output result and the preset knowledge distillation algorithm; Determine a total loss function according to each of the focus level information, the student prediction result, the teacher prediction result and a preset modulation level factor; The student model is trained according to the total loss function to obtain a pre-trained lightweight model.

5. The method according to claim 4, characterized in that The determining of the total loss function according to each of the focus level information, the student prediction result, the teacher prediction result and the preset modulation level factor comprises: Determine a hard loss function according to each of the focus level information, the teacher prediction result, the preset modulation level factor and the real distribution in the electric power Internet of Things traffic sample; Determine a soft loss function based on the teacher prediction result and the student prediction result combined with a divergence loss function; A total loss function is determined according to the hard loss function, the soft loss function and a preset variable factor.

6. The method according to claim 1, characterized in that After inputting the intermediate classification result into a preset support vector machine for traffic threat prediction to obtain the potential threat detection result of the associated IoT edge device, the method further includes: The potential threat detection result is fed back to the associated IoT edge device so that the associated IoT edge device responds to and repairs the potential threat detection result.

7. A flow safety detection device for power Internet of Things equipment, characterized in that: include: A result acquisition module is used to obtain the preliminary classification results determined by the associated IoT edge device based on the original traffic of the power IoT; The preliminary classification result is obtained by using a pre-trained lightweight model deployed on the associated IoT edge device to identify the type of the power IoT raw traffic; A first determination module is used to classify the preliminary classification result based on the threat traffic detection model pre-trained in the cloud and determine an intermediate classification result; A second determination module is used to input the intermediate classification result into a preset support vector machine for traffic threat prediction to obtain a potential threat detection result of the associated IoT edge device; The device also includes: a model training module; The model training module includes: A sample set acquisition unit, used to acquire a pre-trained electric power Internet of Things traffic sample set; a sixth determination unit, configured to use a threat traffic detection model pre-trained in the cloud as a teacher model; A seventh determination unit, configured to use the one-dimensional preset convolutional neural network and the improved Transformer model in the threat traffic detection model as student models; An information determination unit, used to determine the focus level information under each category according to the pre-trained power Internet of Things traffic sample set and the preset softening weight distribution parameters; A model determination unit, used to train the student model according to the pre-trained electric power Internet of Things traffic sample set, the preset knowledge distillation algorithm, each of the focus level information and the teacher model, and determine the pre-trained lightweight model; Wherein, the information determination unit is specifically used for: Based on the category frequency of each category in the pre-trained power Internet of Things traffic sample set and the sample size of each category combined with the preset softened weight distribution parameters, the focus level information under each category is determined by the following formula : ; in, represents the category frequency of category i in the pre-trained power IoT traffic sample set, represents the sample size of category i, represents the preset softening weight distribution parameter, and D represents the number of categories.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory in communication with the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the flow security detection method for electric power Internet of Things equipment described in any one of claims 1-6.