Industrial Internet Traffic Sample Expansion Method and System Based on VAE-GAN
By combining VAE and GAN models, local and timing characteristics of industrial Internet traffic are extracted, VAE parameters are optimized using GAN discriminator to generate realistic traffic samples, which solves the problem of sample inaccuracy in the existing technology and improves the training effect of the model.
Patent Information
- Application Number
- CN202510415264.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-04-03
AI Technical Summary
In the prior art, the industrial Internet traffic samples generated by machine learning models cannot accurately and objectively reflect real data. The samples generated by VAE lack clear details, and the samples generated by GAN lack authenticity, resulting in poor model training results.
Combining the VAE and GAN models, local and timing feature vectors are extracted through the VAE encoder, potential variable data are generated, and the GAN discriminator evaluation and feedback is used to optimize the VAE decoder parameters and generate realistic traffic samples.
The generated traffic samples are closer to real data, improving the accuracy and generalization capabilities of machine learning models, and providing high-quality training data for industrial Internet security analysis.
Smart Images

Figure CN120223403B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic sample expansion, and particularly relates to an industrial Internet traffic sample expansion method and system based on VAE-GAN. Background Art
[0002] As a revolutionary technology, the Internet has currently achieved deep integration with different fields. As a product of the deep integration of traditional industries and Internet technologies, the industrial Internet has developed rapidly in recent years. As of now, the industrial Internet industry scale has reached 5.0 trillion yuan, which means the wide application of a large number of industrial devices. The industrial Internet has the characteristics of openness, interconnectivity, and complexity. Any device connected to the network may become an entry point for attacks. The increase in devices also means an expansion of the scope of network attacks. This situation has led to severe security challenges for the industrial Internet.
[0003] In the prior art, methods such as encrypted traffic classification and abnormal traffic detection are generally used to improve the security of the industrial Internet. These methods rely on machine learning model training, and machine learning model training often requires a large amount of traffic data as a basis. High-quality traffic data is the key to improving the performance of machine learning models. However, in the industrial Internet, the acquisition cost of traffic data is high and the samples are insufficient, which leads to poor training effects of machine learning models.
[0004] Most of the existing traffic data expansion methods use VAE (Variational Auto-Encoders) models and GAN (Generative Adversarial Network) models, but both have certain defects in data expansion: The traffic data samples generated by VAE may lack clear details and structures, resulting in inaccurate and non-specific expanded traffic samples. Therefore, the quality of the traffic samples generated by VAE is poor; Although the GAN network model and its variants are the traffic data expansion methods favored by most fields, the generator of the GAN network model will fall into generating the same or very similar traffic samples, which leads to the lack of authenticity of the generated traffic samples. Therefore, the expanded traffic samples generated by the existing machine learning models cannot accurately and objectively reflect the real data of the industrial Internet. Summary of the Invention
[0005] The main object of the present invention is to provide an industrial Internet traffic sample expansion method and system based on VAE-GAN, aiming to solve the technical problem that the traffic samples expanded by machine learning models in the prior art cannot accurately and objectively reflect the real data of the industrial Internet.
[0006] The present invention proposes an industrial Internet traffic sample expansion method based on VAE-GAN, including:
[0007] Obtain the original training data, and preprocess the original training data to obtain the original tensor data;
[0008] Input the original tensor data into the VAE encoder to extract the feature vectors corresponding to the original tensor data;
[0009] Multiple said local feature vectors and multiple said temporal feature vectors generate multiple context feature vectors through the first fully connected layer of the VAE encoder;
[0010] Multiple said context feature vectors generate latent variable data through the second fully connected layer of the VAE encoder;
[0011] Input the latent variable data into the VAE decoder for data expansion to obtain the reconstructed data;
[0012] Input the reconstructed data and the original tensor data into the discriminator of the GAN model to generate an evaluation result;
[0013] Judge whether the evaluation result meets the preset conditions;
[0014] If the evaluation result does not meet the preset conditions, the discriminator generates feedback information according to the evaluation result, the VAE decoder adjusts its own parameters according to the feedback information, regenerates the reconstructed data, and returns to the step of inputting the reconstructed data and the original tensor data into the discriminator of the GAN model to generate an evaluation result;
[0015] If the reconstructed data matches the original tensor data according to the preset conditions, output the reconstructed data and use the reconstructed data as the traffic sample.
[0016] Preferably, the step of obtaining the target training data and preprocessing the target training data to obtain the original tensor data includes:
[0017] Obtain the original data set, where the original data set includes industrial public data, simulated industrial scenario data, and real industrial scenario data;
[0018] Slice the original data set at the data stream level to obtain multiple streams, where each stream contains a fixed number of traffic packets;
[0019] Perform data cleaning on multiple traffic packets, and slice each cleaned traffic packet according to a preset byte length to obtain multiple data segments;
[0020] Scale multiple data segments in each traffic packet proportionally according to a preset ratio to obtain multiple multi-dimensional tensors corresponding to the multiple data segments, and integrate all the multi-dimensional tensors of multiple traffic packets to obtain original tensor data.
[0021] Preferably, the step of inputting the original tensor data into a VAE encoder to extract the eigenvectors corresponding to the original tensor data includes:
[0022] Input the original tensor data into the two convolutional layers of the VAE encoder to extract the local eigenvectors of the original tensor data;
[0023] Construct an LSTM layer in the VAE encoder;
[0024] Extract the temporal eigenvectors of the original tensor data based on the LSTM layer;
[0025] Take the local eigenvectors and the temporal eigenvectors as the eigenvectors corresponding to the original tensor data.
[0026] Preferably, the step of generating latent variable data from the multiple context eigenvectors through the second fully connected layer of the VAE encoder includes:
[0027] Input the multiple context eigenvectors into the second fully connected layer of the VAE encoder to map the multiple context eigenvectors to the latent space, and calculate the mean, variance, and standard deviation corresponding to the multiple context eigenvectors in the latent space;
[0028] Randomly sample based on the mean and variance corresponding to the multiple context eigenvectors to generate multiple target eigenvectors;
[0029] Obtain multiple random noises;
[0030] Randomly fuse the multiple random noises with the multiple target eigenvectors to obtain multiple fused vectors;
[0031] The multiple fused vectors generate latent variable data based on the principle of the reparameterization trick.
[0032] Preferably, the step of inputting the latent variable data into the VAE decoder for data augmentation to obtain reconstructed data includes:
[0033] Input the latent variable data into the fully connected layer of the VAE decoder for augmentation to obtain intermediate eigenvectors;
[0034] Input the intermediate eigenvectors into the bidirectional LSTM layer of the VAE decoder, and restore the length and number of channels of the intermediate eigenvectors based on the principle of the transposed convolutional layer;
[0035] Generate reconstruction data with the same shape as the original tensor data based on the length and number of channels of the intermediate feature vector.
[0036] Preferably, after the step of generating reconstruction data with the same shape as the original tensor data, it includes:
[0037] Calculate the mean square error between the reconstruction data and the original tensor data based on the reconstruction loss function;
[0038] Regularize the latent space of the latent variable data based on KL divergence to obtain the KL divergence value;
[0039] Generate the total loss value of the VAE decoder based on the mean square error and the KL divergence value;
[0040] Optimize the parameters of the VAE decoder based on the total loss value;
[0041] Input the latent variable data into the VAE decoder with optimized parameters for augmentation to generate optimized data, and use the optimized data as the reconstruction data.
[0042] Preferably, the step of inputting the reconstruction data and the original tensor data into the discriminator of the GAN model to generate an evaluation result includes:
[0043] The reconstruction data and the original tensor data respectively pass through the convolutional layer and pooling layer of the GAN model discriminator to extract reconstruction features and original features;
[0044] Input the reconstruction features and the tensor features into the fully connected layer of the GAN model discriminator respectively to map the reconstruction features and the tensor features into reconstruction probability values and original probability values respectively;
[0045] Use the reconstruction probability value and the original probability value as the evaluation result.
[0046] Preferably, the step of the discriminator generating feedback information according to the evaluation result includes:
[0047] Fix the parameters of the VAE encoder and decoder;
[0048] Obtain the reconstruction probability value and the original probability value in the evaluation result;
[0049] Generate the discriminator loss value of the discriminator of the GAN model according to the original probability value and the reconstruction probability value;
[0050] Obtain the weighted average of the reconstruction data and the total loss value of the VAE decoder;
[0051] Construct a generator loss function of the GAN model based on the weighted mean, the reconstruction probability value, and the total loss value of the VAE decoder;
[0052] Construct a total loss function of the VAE-GAN fusion model based on the generator loss function of the GAN model and the total loss value of the VAE decoder;
[0053] The discriminator of the GAN model generates feedback information based on the total loss function.
[0054] The present invention also provides an industrial Internet traffic sample augmentation system based on VAE-GAN, including multiple modules, and the multiple modules are used to implement the steps of any one of the above methods.
[0055] The present invention also provides a computer device, including a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps of the above-mentioned industrial Internet traffic sample augmentation method based on VAE-GAN are implemented.
[0056] The beneficial effects of the present invention are as follows: The present invention first obtains the original training data, preprocesses it to obtain multi-dimensional original tensor data, then extracts local feature vectors and temporal feature vectors according to the VAE encoder, and generates corresponding context feature vectors, generates latent variable data according to the context feature vectors, puts the latent variable data into the VAE decoder for data augmentation to obtain reconstructed data; inputs the reconstructed data into the discriminator of the GAN model, and the discriminator of the GAN model can evaluate the reconstructed data generated by the decoder of the VAE model, judge whether it is close to the real traffic data, and generate feedback information. The VAE decoder adjusts its own parameters according to the feedback information and regenerates the reconstructed data. The discriminator of the GAN model judges the regenerated reconstructed data again until it is close to the real traffic data. In this way, by continuously optimizing the own parameters of the VAE decoder, it can generate more realistic and real-data-close traffic samples, so as to more accurately and objectively reflect the real data of the industrial Internet. More preferably, it can provide high-quality training data sets for traffic analysis technologies such as industrial Internet encrypted traffic classification and abnormal traffic detection, and improve the accuracy and generalization ability of the analysis model. Description of the Drawings
[0057] Figure 1 It is a schematic flowchart of the method according to an embodiment of the present invention.
[0058] The realization, functional characteristics and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. Detailed Embodiments
[0059] It should be understood that the specific embodiments described herein are merely used to explain the present invention and are not used to limit the present invention.
[0060] As Figure 1 shown, this application provides an industrial Internet of Things traffic sample expansion method based on VAE-GAN, including:
[0061] S1. Obtain the original training data, and preprocess the original training data to obtain the original tensor data;
[0062] S2. Input the original tensor data into the VAE encoder to extract the feature vectors corresponding to the original tensor data;
[0063] S3. Multiple said local feature vectors and multiple said temporal feature vectors generate multiple context feature vectors through the first fully connected layer of the VAE encoder;
[0064] S4. Multiple said context feature vectors generate latent variable data through the second fully connected layer of the VAE encoder;
[0065] S5. Input the latent variable data into the VAE decoder for data expansion to obtain the reconstructed data;
[0066] S6. Input the reconstructed data and the original tensor data into the discriminator of the GAN model to generate an evaluation result;
[0067] S7. Determine whether the evaluation result meets the preset conditions;
[0068] If the evaluation result does not meet the preset conditions, the discriminator generates feedback information according to the evaluation result, the VAE decoder adjusts its own parameters according to the feedback information, regenerates the reconstructed data, and returns to the step of inputting the reconstructed data and the original tensor data into the discriminator of the GAN model to generate an evaluation result;
[0069] If the reconstructed data matches the original tensor data according to the preset conditions, output the reconstructed data and use the reconstructed data as the traffic sample.
[0070] As described in the above steps S1 - S7, first, the original training data is obtained and pre - processed to obtain multi - dimensional original tensor data. Then, local feature vectors are extracted according to the VAE encoder. Since the VAE encoders in the prior art often only extract local feature vectors, this also results in poor quality of the generated traffic samples. In order to obtain rich traffic features so that the subsequent generated traffic samples are closer to real data, this application also extracts time - series feature vectors, and based on the VAE encoder, context feature vectors corresponding to the local feature vectors and time - series feature vectors are generated, and the context feature vectors are mapped into the latent space to map high - dimensional feature vectors into low - dimensional vectors to obtain latent variable data. The latent variable data is put into the VAE decoder for data augmentation, and the reconstructed data is obtained after the augmentation is completed.
[0071] The original VAE model includes an encoder and a decoder, and the GAN model includes a generator and a discriminator. Among them, the decoder of the VAE model and the generator of the GAN model are both used for traffic augmentation. In order to make the reconstructed data closer to real industrial Internet data, and to avoid repeated generation of reconstructed data and reduce the computing cost, this application combines the VAE model and the GAN model. The combination method is to extract the encoder and decoder of the VAE model and the discriminator of the GAN model. The encoder of the VAE model can encode the original tensor data into a distribution in the latent space, which provides a richer latent space representation for the discriminator of the GAN model. The VAE model is trained by maximizing the likelihood, which easily leads to blurred generated traffic samples. The discriminator in the GAN model can evaluate the quality of the generated traffic samples. The VAE - GAN model can take advantage of this, allowing the traffic samples generated by the VAE model (i.e., the reconstructed data in this application) to be screened by the discriminator of the GAN model, so that it generates more realistic and closer - to - real - data traffic samples. In this way, the GAN model can also better learn the data distribution, thereby reducing the possibility of mode collapse. Combining the advantages of both improves the quality of traffic data generation.
[0072] Specifically, the reconstructed data is input into the discriminator of the GAN model. The discriminator of the GAN model can evaluate the reconstructed data generated by the VAE model decoder to determine whether it is close to the real traffic data, that is, whether it is close to the original training data. According to the evaluation result, the discriminator generates feedback information. The VAE decoder adjusts its own parameters according to the feedback information and regenerates the reconstructed data. The discriminator of the GAN model then judges the regenerated reconstructed data until it is close to the real traffic data. In this way, by continuously optimizing the parameters of the VAE decoder, it can generate more realistic and real-data-close traffic samples, so as to more accurately and objectively reflect the real data of the industrial Internet. More preferably, it can provide a high-quality training data set for traffic analysis technologies such as industrial Internet encrypted traffic classification and abnormal traffic detection, and improve the accuracy and generalization ability of the analysis model.
[0073] In one embodiment, the step S1 of obtaining the target training data and preprocessing the target training data to obtain the original tensor data includes:
[0074] S11. Obtain the original data set, where the original data set includes industrial public data, simulated industrial scenario data, and real industrial scenario data;
[0075] S12. Split the original data set at the data stream level to obtain multiple streams, where each stream contains a fixed number of traffic packets;
[0076] S13. Clean the data of multiple traffic packets, and slice each cleaned traffic packet according to a preset byte length to obtain multiple data segments;
[0077] S14. Scale the multiple data segments in each traffic packet proportionally according to a preset ratio to obtain multiple multi-dimensional tensors corresponding to the multiple data segments, and integrate all the multi-dimensional tensors of multiple traffic packets to obtain the original tensor data.
[0078] As described in the above steps S11 - S14, in order to generate data samples containing the characteristics of industrial Internet traffic, an original data set containing a variety of industrial - specific protocols is constructed by integrating public data sets, simulated industrial scenarios, and real industrial scenarios during data collection. The original data set uses the PCAP file format. The original PCAP file is sliced at the data stream level. First, redundant traffic packets in the PCAP file are removed, traffic packets containing invalid IP addresses and port numbers are filtered, and traffic packets unrelated to the transmission content of specific traffic (such as DNS / ARP / DHCP, etc.) are removed, obtaining multiple sliced traffic packets. Each traffic packet is sliced to obtain multiple data segments with a byte length of L (preset byte length). The multiple data segments are scaled proportionally so that they fall into a specific small interval, obtaining multiple multi - dimensional tensors. The multi - dimensional tensors of all traffic packets are summarized to obtain the original tensor data.
[0079] In one embodiment, step S2 of inputting the original tensor data into the VAE encoder to extract the feature vector corresponding to the original tensor data includes:
[0080] S21: Input the original tensor data into the two - layer convolutional layer of the VAE encoder to extract the local feature vector of the original tensor data;
[0081] S22: Construct an LSTM layer in the VAE encoder;
[0082] S23: Extract the temporal feature vector of the original tensor data based on the LSTM layer;
[0083] S24: Use the local feature vector and the temporal feature vector as the feature vector corresponding to the original tensor data.
[0084] As described in the above steps S21 - S24, the encoder of the VAE contains two - layer convolutional layers for extracting the local feature vector of the original tensor data, mapping the original tensor data from a high - dimensional space to a low - dimensional space. Since the existing VAE encoder can only extract local feature vectors, the quality of the traffic samples generated by its decoder is also poor. In order to extract richer traffic features, an LSTM layer is constructed in the VAE encoder, and the temporal feature vector of the original tensor data is extracted based on the LSTM layer.
[0085] In one embodiment, step S4 of generating latent variable data by the second fully - connected layer of the VAE encoder for the multiple context feature vectors includes:
[0086] S41. Input the multiple context feature vectors into the second fully-connected layer of the VAE encoder to map the multiple context feature vectors into the latent space, and calculate the mean, variance, and standard deviation corresponding to the multiple context feature vectors in the latent space;
[0087] S42. Randomly sample and generate multiple target feature vectors according to the mean and variance corresponding to the multiple context feature vectors;
[0088] S43. The multiple target feature vectors generate latent variable data based on the principle of the reparameterization trick.
[0089] As described in the above steps S41 - S43, map the multiple context feature vectors into the latent space through two second fully-connected layers, and calculate the mean, variance, and standard deviation corresponding to the multiple context feature vectors in the latent space; through the reparameterization trick, these parameters can be combined with random noise to generate latent variable data.
[0090] In one embodiment, the step S5 of inputting the latent variable data into the VAE decoder for data augmentation to obtain the reconstructed data includes:
[0091] S51. Input the latent variable data into the fully-connected layer of the VAE decoder for augmentation to obtain intermediate feature vectors;
[0092] S52. Input the intermediate feature vectors into the bidirectional LSTM layer of the VAE decoder, and restore the length and number of channels of the intermediate feature vectors based on the principle of the transposed convolutional layer;
[0093] S53. Generate reconstructed data with the same shape as the original tensor data based on the length and number of channels of the intermediate feature vectors.
[0094] As described in the above steps S51 - S53, a fully-connected layer in the VAE decoder is used to expand the latent variable data into intermediate feature vectors for representation, then the expanded intermediate feature vectors are processed using a bidirectional LSTM layer, and the transposed convolutional layer is used to gradually restore the length and number of channels of the intermediate feature vectors, and finally generate reconstructed data with the same shape as the input data (original tensor data).
[0095] In one embodiment, after the step S53 of generating the reconstructed data with the same shape as the original tensor data, it includes:
[0096] S54. Calculate the mean square error between the reconstructed data and the original tensor data based on the reconstruction loss function;
[0097] S55. Regularize the latent space of the latent variable data based on the KL divergence to obtain the KL divergence value;
[0098] S56. Generate the total loss value of the VAE decoder based on the mean squared error and KL divergence value;
[0099] S57. Optimize the parameters of the VAE decoder based on the total loss value;
[0100] S58. Input the latent variable data into the VAE decoder with optimized parameters for augmentation to generate optimized data, and use the optimized data as the reconstructed data.
[0101] As described in the above steps S54 - S58, in order to make the reconstructed data as close as possible to the original tensor data, the VAE model is optimized here by calculating the mean squared error (MSE) between the reconstructed data and the original tensor data. Specifically, the parameters of the VAE model encoder and decoder are updated and optimized by minimizing the reconstruction loss and KL divergence. Among them, minimizing the reconstruction loss measures the similarity between the reconstructed data generated by the decoder and the original input data (original tensor data), and the reconstruction loss ensures that the decoder can restore the original input data as much as possible, thereby improving the reconstruction ability of the VAE model. Among them, the expression of the reconstruction loss function is:
[0102]
[0103] where the Reconstruction Loss represents the mean squared error of the reconstruction loss, N represents the batch size, x i represents the original tensor data of the i-th input, and the x recon,i represents the i-th reconstructed data generated by the decoder;
[0104] The KL divergence is used to regularize the latent space so that the distribution of the latent variable data is close to the standard normal distribution N(0, 1). The KL divergence regularizes the latent space, making the distribution of the latent variable data smoother and facilitating the generation of new samples. The calculation formula of the KL divergence is:
[0105]
[0106] where the KL Divergence represents the KL divergence value, N represents the batch size, represents the mean of the latent variable data, represents the standard deviation of the latent variable data;
[0107] Generate the total loss value of the VAE decoder based on the mean squared error and KL divergence value. Among them, the calculation formula of the total loss value is:
[0108] VAE Total Loss = Reconstruction Loss + β * KLDivergence;
[0109] Among them, the VAE Total Loss represents the total loss value, and β represents a hyperparameter used to balance the reconstruction loss and the KL divergence.
[0110] In one embodiment, the step S6 of inputting the reconstructed data and the original tensor data into the discriminator of the GAN model to generate an evaluation result includes:
[0111] S61. The reconstructed data and the original tensor data respectively pass through the convolutional layer and the pooling layer of the GAN model discriminator to extract reconstructed features and original features;
[0112] S62. The reconstructed features and the tensor features are respectively input into the fully connected layer of the GAN model discriminator to map the reconstructed features and the tensor features into reconstructed probability values and original probability values respectively;
[0113] S63. The reconstructed probability value and the original probability value are used as the evaluation result.
[0114] As described in the above steps S61 - S63, the discriminator of the GAN model is applied to distinguish whether the input data is real or fake data generated by the generator of the GAN model. The discriminator includes four convolutional layers and pooling layers for extracting reconstructed features and original features, and two fully connected layers for mapping the reconstructed features and the original features into reconstructed probability values and original probability values.
[0115] In one embodiment, the step S7 of the discriminator generating feedback information according to the evaluation result includes:
[0116] S71. Fix the parameters of the VAE encoder and decoder;
[0117] S72. Obtain the reconstructed probability value and the original probability value in the evaluation result;
[0118] S73. Generate the discriminator loss value of the GAN model according to the original probability value and the reconstructed probability value;
[0119] S74. Obtain the weighted average value of the reconstructed data and the total loss value of the VAE decoder;
[0120] S75. Construct the generator loss function of the GAN model based on the weighted mean, the reconstructed probability value, and the total loss value of the VAE decoder;
[0121] S76. Construct the total loss function of the VAE - GAN fusion model based on the generator loss function of the GAN model and the total loss value of the VAE decoder;
[0122] S77. The discriminator of the GAN model generates feedback information based on the total loss function.
[0123] As described in the above steps S71 - S77, during the training process, the parameters of the VAE (parameters of the encoder and decoder) can be fixed, which can ensure that the training of the generator and discriminator is not interfered by the update of the VAE parameters. Thus, the generator and discriminator of the GAN model can focus more on learning how to generate and recognize real data. The VAE - GAN model uses the discriminator to ensure the authenticity of data generation. By fixing the parameters of the VAE and updating the parameters of the discriminator and generator, the discriminator can better distinguish real and generated data, and at the same time, the decoder can generate more realistic data. Since the VAE model consists of two parts: the encoder and the decoder, and the GAN model consists of two parts: the generator and the discriminator. Although the generator is not used in the VAE - GAN model, each structure has its own independent parameters, and the update of each parameter of the model depends on the value of the loss function. Therefore, although the VAE - GAN model of this application does not have the structure of the generator, it still uses the generator loss function.
[0124] Specifically, the loss function of the discriminator is used to train the discriminator so that it can better distinguish real data and generated data. The discriminator loss consists of two parts:
[0125] 1. Loss of real data:
[0126]
[0127] Among them, the Loss real represents the original loss value, represents the weighted average value of the tensor data, and D(x) represents the original probability value of the discriminator for the tensor data (real data);
[0128] 2. Loss of the reconstructed data generated by the decoder:
[0129]
[0130] Among them, the Loss fake represents the reconstruction loss value, represents the weighted average value of the reconstructed data, G(z) represents the fake data generated by the generator, and D(G(z)) represents the reconstruction probability value of the discriminator for the reconstructed data (fake data);
[0131] The discriminator loss value of the GAN model is the sum of the loss of real data and the loss of the reconstructed data generated by the decoder.
[0132] The loss function of the generator is used to train the generator so that the fake data it generates can deceive the discriminator. The generator loss is:
[0133]
[0134] Among them, the Generator Loss represents the generator loss value, and the VAE Total Loss represents the total loss value. represents the weighted mean of the reconstructed data, and D(G(z)) represents the reconstruction probability value of the discriminator for the reconstructed data (fake data).
[0135] The total loss function of the VAE-GAN fusion model is:
[0136] VAE-VAE Total Loss = VAE Total Loss + λ * Generator Loss;
[0137] Among them, VAE-GAN Total Loss represents the total loss value of the VAE-GAN fusion model, and λ represents a hyperparameter used to balance the VAE loss and the GAN loss.
[0138] The present invention also provides an industrial Internet of Things traffic sample expansion system based on VAE-GAN, including multiple modules, and the multiple modules are used to implement the steps of any one of the above methods.
[0139] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium provided in this application and used in the embodiments can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0140] It should be noted that in this text, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent in such a process, device, article or method. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, device, article or method including such an element.
[0141] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.
Claims
1. An industrial Internet of Things traffic sample expansion method based on VAE-GAN, characterized in that Including: Obtain the original training data, and preprocess the original training data to obtain the original tensor data; Input the original tensor data into the VAE encoder to extract multiple feature vectors corresponding to the original tensor data; Multiple said feature vectors generate multiple context feature vectors through the first fully connected layer of the VAE encoder; Multiple said context feature vectors generate latent variable data through the second fully connected layer of the VAE encoder; Input the latent variable data into the VAE decoder for data augmentation to obtain the reconstructed data; Input the reconstructed data and the original tensor data into the discriminator of the GAN model to generate an evaluation result; Determine whether the evaluation result meets the preset conditions; If the evaluation result does not meet the preset conditions, the discriminator generates feedback information according to the evaluation result, the VAE decoder adjusts its own parameters according to the feedback information, regenerates the reconstructed data, and returns to the step of inputting the reconstructed data and the original tensor data into the discriminator of the GAN model to generate an evaluation result; If the reconstructed data matches the original tensor data according to the preset conditions, output the reconstructed data and use the reconstructed data as the traffic sample.
2. The method for expanding industrial Internet traffic samples based on VAE-GAN according to claim 1, wherein The step of obtaining the target training data and preprocessing the target training data to obtain the original tensor data includes: Obtain the original data set, where the original data set includes industrial public data, simulated industrial scenario data, and real industrial scenario data; Slice the original data set at the data stream level to obtain multiple streams, where each stream contains a fixed number of traffic packets; Clean the data of multiple traffic packets, and slice each cleaned traffic packet according to the preset byte length to obtain multiple data segments; Scale each of the multiple data segments in the traffic packet proportionally according to the preset ratio to obtain multiple multi-dimensional tensors corresponding to the multiple data segments, and integrate all the multi-dimensional tensors of the multiple traffic packets to obtain the original tensor data.
3. The method for expanding industrial Internet traffic samples based on VAE-GAN according to claim 1, wherein The step of inputting the original tensor data into the VAE encoder to extract the feature vectors corresponding to the original tensor data includes: Input the original tensor data into the two convolutional layers of the VAE encoder to extract the local feature vectors of the original tensor data; Construct an LSTM layer in the VAE encoder; Extract the temporal feature vectors of the original tensor data based on the LSTM layer; Use the local feature vectors and the temporal feature vectors as the feature vectors corresponding to the original tensor data.
4. The method for expanding industrial Internet traffic samples based on VAE-GAN according to claim 1, wherein The step of generating the latent variable data by the multiple said context feature vectors through the second fully connected layer of the VAE encoder includes: Input multiple said context feature vectors into the second fully connected layer of the VAE encoder to map the multiple context feature vectors to the latent space, and calculate the mean, variance, and standard deviation corresponding to the multiple context feature vectors in the latent space; Randomly sample according to the mean and variance corresponding to the multiple context feature vectors to generate multiple target feature vectors; Obtain multiple random noises; Randomly fuse the multiple random noises with the multiple target feature vectors to obtain multiple fusion vectors; Multiple of the fusion vectors generate latent variable data based on the principle of the reparameterization trick.
5. The method for expanding industrial Internet traffic samples based on VAE-GAN according to claim 1, wherein The step of inputting the latent variable data into the VAE decoder for data augmentation to obtain the reconstructed data includes: Input the latent variable data into the fully connected layer of the VAE decoder for augmentation to obtain an intermediate feature vector; Input the intermediate feature vector into the bidirectional LSTM layer of the VAE decoder, and restore the length and number of channels of the intermediate feature vector based on the principle of the transposed convolutional layer; Based on the length and number of channels of the intermediate feature vector, generate reconstructed data with the same shape as the original tensor data.
6. The method for expanding industrial Internet traffic samples based on VAE-GAN according to claim 5, wherein After the step of generating the reconstructed data with the same shape as the original tensor data, it includes: Calculate the mean square error between the reconstructed data and the original tensor data based on the reconstruction loss function; Regularize the latent space of the latent variable data based on the KL divergence to obtain the KL divergence value; Generate the total loss value of the VAE decoder based on the mean square error and the KL divergence value; Optimize the parameters of the VAE decoder based on the total loss value; Input the latent variable data into the VAE decoder with optimized parameters for augmentation to generate optimized data, and use the optimized data as the reconstructed data.
7. The method for expanding industrial Internet traffic samples based on VAE-GAN according to claim 1, wherein The step of inputting the reconstructed data and the original tensor data into the discriminator of the GAN model to generate an evaluation result includes: The reconstructed data and the original tensor data respectively pass through the convolutional layer and the pooling layer of the discriminator of the GAN model to extract the reconstructed features and the original features; Input the reconstructed features and the tensor features into the fully connected layer of the discriminator of the GAN model respectively to map the reconstructed features and the tensor features into the reconstructed probability value and the original probability value respectively; Use the reconstructed probability value and the original probability value as the evaluation result.
8. The method for expanding industrial Internet traffic samples based on VAE-GAN according to claim 1, wherein The step of the discriminator generating feedback information based on the evaluation result includes: Fix the parameters of the VAE encoder and decoder; Obtain the reconstructed probability value and the original probability value in the evaluation result; Generate the discriminator loss value of the discriminator of the GAN model according to the original probability value and the reconstructed probability value; Obtain the weighted average value of the reconstructed data and the total loss value of the VAE decoder; Construct the generator loss function of the GAN model based on the weighted average value, the reconstructed probability value and the total loss value of the VAE decoder; Construct the total loss function of the VAE-GAN fusion model based on the generator loss function of the GAN model and the total loss value of the VAE decoder; The discriminator of the GAN model generates feedback information based on the total loss function.
9. An industrial Internet of Things traffic sample expansion system based on VAE-GAN, including multiple modules, characterized in that, Multiple modules are used to implement the steps of the method according to any one of claims 1 to 8.
10. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.