Data generation method and device, data detection method and device and related equipment

By calculating the attention parameters of the initial training data and using a stable diffusion model, the problem of imbalance in the training data of the classification model is solved, and the detection accuracy is significantly improved.

CN118940175APending Publication Date: 2024-11-12CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410989365.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In the prior art, due to the small amount of abnormal data during training, the abnormal data and normal data in the training set are unbalanced, thereby reducing the detection accuracy.

Method used

By obtaining the correlation matrix of the initial training data, calculating attention parameters to preprocess the data, and using the stable diffusion model to diffuse the data, more balanced training data is obtained to improve the detection accuracy of the classification model.

Benefits of technology

By selecting important training data and diffusing the attention parameters, more balanced training data of abnormal data and normal data are obtained, which significantly improves the detection accuracy of the classification model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940175A_ABST
    Figure CN118940175A_ABST
Patent Text Reader

Abstract

The invention provides a data generation method and device, a data detection method and device and related equipment.The data generation method comprises the steps that at least two pieces of initial training data are obtained, and the initial training data comprise normal query data and abnormal query data; based on a correlation matrix between different initial training data, obtaining an attention parameter of each initial training data relative to other initial training data; the correlation matrix is used for indicating correlation between different initial training data; preprocessing each piece of corresponding initial training data by using the attention parameter of each piece of initial training data relative to other initial training data to obtain preprocessed data corresponding to each piece of initial training data; and diffusing the preprocessed training data by using a stable diffusion model to obtain target training data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data detection technology, and in particular to a data generation method, a data detection method, a device and related equipment. Background Art

[0002] In the related art, classification models are usually used to detect whether query data is abnormal data, such as intrusion data, etc. However, when training the classification model, since the amount of abnormal data is small, the abnormal data and normal data in the training set are unbalanced, which leads to low detection accuracy of the classification model. Summary of the invention

[0003] The present disclosure provides a data generation method, a data detection method, an apparatus and related equipment to solve the problems in the related art.

[0004] A first aspect of the present disclosure provides a data generation method, the method comprising:

[0005] Acquire at least two initial training data, wherein the initial training data includes normal query data and abnormal query data;

[0006] Based on a correlation matrix between different initial training data, obtaining an attention parameter of each initial training data relative to other initial training data; the correlation matrix is ​​used to indicate the correlation between different initial training data;

[0007] Preprocessing each corresponding initial training data using the attention parameter of each initial training data relative to other initial training data to obtain preprocessed data corresponding to each initial training data;

[0008] The pre-processed training data is diffused using a stable diffusion model to obtain target training data.

[0009] In one embodiment, obtaining the attention parameter of each of the initial training data relative to other initial training data based on the correlation matrix between different initial training data includes:

[0010] Obtaining a query vector, a key vector, and a value vector for each of the initial training data;

[0011] Using the preset query vector weight, key vector weight and value vector weight, weighting the query vector, the key vector and the value vector respectively, to obtain the query vector, the key vector and the value vector after weighting each of the initial training data;

[0012] Multiplying the weighted query vector and the key vector of each initial training data with the weighted query vector and the key vector of other initial training data to obtain a correlation matrix between each initial training data and other initial training data;

[0013] Determine in the correlation matrix that the elements corresponding to the other initial training data are attention parameters of each initial training data relative to the other initial training data.

[0014] In one embodiment, the preprocessing of each corresponding initial training data using the attention parameter of each initial training data relative to other initial training data to obtain the preprocessed data corresponding to each initial training data includes:

[0015] Sum the attention parameters of each of the initial training data relative to other initial training data to obtain a first sum value;

[0016] Performing softmax processing or relu processing on the first sum value to obtain a preprocessed first sum value;

[0017] The preprocessed first sum value is multiplied by the value vector of the corresponding initial training data to obtain preprocessed data corresponding to each initial training data.

[0018] A second aspect of the present disclosure provides a data detection method, the method comprising:

[0019] Obtain the data to be tested;

[0020] The data to be detected is classified using a first classification model to obtain a classification result of the data to be detected; wherein the first classification model refers to a model obtained by training a second classification model using the target training data described in any one of claims 1 to 3; and the classification result is normal data or abnormal data.

[0021] In one embodiment, the first classification model adopts a VAGMM model, and the fully connected layer of the VAGMM model adopts a GRU encoding layer.

[0022] A third aspect of the present disclosure provides a data generating device, the device comprising:

[0023] An initial training data acquisition unit, used to acquire at least two initial training data, wherein the initial training data includes normal query data and abnormal query data;

[0024] an attention parameter acquisition unit, configured to acquire an attention parameter of each of the initial training data relative to other initial training data based on a correlation matrix between different initial training data; the correlation matrix is ​​used to indicate the correlation between different initial training data;

[0025] A preprocessing data acquisition unit, used to preprocess each corresponding initial training data using the attention parameter of each initial training data relative to other initial training data, to obtain preprocessing data corresponding to each initial training data;

[0026] A target training data acquisition unit is used to diffuse the pre-processed training data using a stable diffusion model to obtain target training data.

[0027] A fourth aspect of the present disclosure provides a data detection device, the device comprising:

[0028] A data acquisition unit for detecting, used for acquiring data for detecting;

[0029] A classification result acquisition unit, used to classify the data to be detected using a first classification model to obtain a classification result of the data to be detected; wherein the first classification model refers to a model obtained by training a second classification model using the target training data described in any one of claims 1 to 3; and the classification result is normal data or abnormal data.

[0030] A fifth aspect of the present disclosure provides an electronic device, including:

[0031] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the embodiment of the first aspect of the present disclosure or the embodiment of the second aspect of the present disclosure.

[0032] The sixth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure or the second aspect embodiment of the present disclosure.

[0033] A seventh aspect embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the method described in the first aspect embodiment of the present disclosure or the second aspect embodiment of the present disclosure.

[0034] In summary, the present disclosure proposes a data generation method, a data detection method, an apparatus and related equipment, wherein the data generation method includes: obtaining at least two initial training data, wherein the initial training data includes normal query data and abnormal query data; based on the correlation matrix between different initial training data, obtaining the attention parameter of each initial training data relative to other initial training data; the correlation matrix is ​​used to indicate the correlation between different initial training data; using the attention parameter of each initial training data relative to other initial training data to preprocess each corresponding initial training data to obtain preprocessed data corresponding to each initial training data; using a stable diffusion model to diffuse the preprocessed training data to obtain target training data.

[0035] The solution provided by the present disclosure can select more important training data from the initial training data through the attention parameter, and then use the stable diffusion model to diffuse the training data, so as to obtain training data with more balanced abnormal data and normal data, so as to use the more balanced training data to train the classification model, which can effectively improve the detection accuracy of the classification model.

[0036] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0038] Figure 1 A schematic diagram of a flow chart of a first data generation method provided in an embodiment of the present disclosure;

[0039] Figure 2 A flowchart of another data generation method provided by an embodiment of the present disclosure;

[0040] Figure 3 A flowchart of another data generation method provided by an embodiment of the present disclosure;

[0041] Figure 4 A schematic diagram of a flow chart of a first data detection method provided in an embodiment of the present disclosure;

[0042] Figure 5 A schematic diagram of the structure of a data generating device provided in an embodiment of the present disclosure;

[0043] Figure 6 A schematic diagram of the structure of a data detection device provided in an embodiment of the present disclosure;

[0044] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0045] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0046] In order to solve the defects in the related technology, the present invention can select more important training data from the initial training data through the attention parameter, and then use the stable diffusion model to diffuse the training data, so as to obtain training data with more balanced abnormal data and normal data, so as to train the classification model with more balanced training data, which can effectively improve the detection accuracy of the classification model.

[0047] The present disclosure is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0048] like Figure 1 As shown, Figure 1 The data generation method provided by the embodiment of the present disclosure comprises the following steps:

[0049] Step 101, obtaining at least two initial training data;

[0050] In one implementation, the initial training data may be obtained through network sniffing, data packet interception, etc., or the corresponding training data may be directly obtained through an open source website as the initial training data.

[0051] In one embodiment, the initial training data includes normal query data and abnormal query data.

[0052] In one embodiment, the initial training data refers to a data set consisting of at least two data used to train a classification model.

[0053] In one embodiment, the initial training data may be query data carrying classification labels, wherein the classification labels are normal data or abnormal data.

[0054] Step 102, based on the correlation matrix between different initial training data, obtaining the attention parameter of each initial training data relative to other initial training data;

[0055] In one embodiment, the correlation matrix is ​​used to indicate the correlation between different initial training data.

[0056] In one embodiment, the correlation matrix may be preset or acquired based on historical experience, which is not limited in the present disclosure.

[0057] In one embodiment, the attention coefficient between different initial data can be obtained by multiplying the initial training data itself and the corresponding correlation matrix.

[0058] Step 103, preprocessing each corresponding initial training data using the attention parameter of each initial training data relative to other initial training data to obtain preprocessed data corresponding to each initial training data;

[0059] In one embodiment, the attention parameter of each initial training data relative to other initial training data may be summed to obtain the sum of the attention parameters, wherein the sum of the attention parameters is used to indicate the importance of the corresponding initial training data relative to other initial training data.

[0060] In one embodiment, the sum of the attention parameters may be multiplied by the corresponding initial training data to obtain preprocessed data corresponding to each of the initial training data.

[0061] In one embodiment, the preprocessed data corresponding to the initial training data carries the importance of the corresponding initial training data relative to other data.

[0062] Step 104: diffuse the pre-processed training data using a stable diffusion model to obtain target training data.

[0063] In one embodiment, the stable diffusion model may adopt TabDDPM (MODELLING TABULAR DATA WITH DIFFUSION MODELS).

[0064] In one embodiment, the stable diffusion model may also adopt other stable diffusion models, which is not limited in the present disclosure.

[0065] In one embodiment, taking the stable diffusion model using TabDDPM as an example, since the preprocessed data contains not only the numerical data corresponding to the preprocessed data, but also the categorical data corresponding to the categorical label, the numerical data can be diffused by using the Gaussian Quantile Transformer, and the categorical data can be diffused by using the interpolation method.

[0066] In one embodiment, the architecture of the stable diffusion model uses MLP as a model for predicting noise.

[0067] In summary, the data generation method proposed in the present disclosure includes: obtaining at least two initial training data, wherein the initial training data include normal query data and abnormal query data; based on the correlation matrix between different initial training data, obtaining the attention parameter of each initial training data relative to other initial training data; the correlation matrix is ​​used to indicate the correlation between different initial training data; using the attention parameter of each initial training data relative to other initial training data to preprocess each corresponding initial training data to obtain preprocessed data corresponding to each initial training data; using a stable diffusion model to diffuse the preprocessed training data to obtain target training data.

[0068] The solution provided by the present disclosure can select more important training data from the initial training data through the attention parameter, and then use the stable diffusion model to diffuse the training data, so as to obtain training data with more balanced abnormal data and normal data, so as to use the more balanced training data to train the classification model, which can effectively improve the detection accuracy of the classification model.

[0069] In one embodiment, if Figure 2 As shown, step 102 includes:

[0070] Step 201, obtaining a query vector, a key vector and a value vector of each of the initial training data;

[0071] In one embodiment, since the initial training data is query data in the form of a query statement, after the initial training data is rewritten into a vector form, it generally includes a query vector, a key vector, and a value vector.

[0072] In one embodiment, it can be expressed by the following mathematical expression:

[0073] Query vector q i , key vector k i and value vector v i .

[0074] In one embodiment, i indicates that the initial training data is the i-th one.

[0075] Step 202, using the preset query vector weight, key vector weight and value vector weight, respectively weighting the query vector, the key vector and the value vector to obtain the query vector, the key vector and the value vector after weighting each of the initial training data;

[0076] In one embodiment, the preset query vector weight, key vector weight, and value vector weight may be expressed by the following mathematical expression:

[0077] Query vector weight ω q , key vector weight ω k and value vector weight ω v .

[0078] In one embodiment, weighted processing is performed on the query vector, the key vector, and the value vector respectively, which can be expressed in the following mathematical expression:

[0079] q i =ω q ·a i , rewritten as a vector: Q = W q I;

[0080] k i =ω k ·a i , rewritten as vector form: K = W k I;

[0081] v i =ω v ·a i , rewritten as vector form: V = W v I;

[0082] Among them, a i Represents the i-th initial training data I = a i ; Q, K, V represent the weighted query vector, the key vector and the value vector respectively.

[0083] Step 203, multiplying the weighted query vector and the key vector of each initial training data with the weighted query vector and the key vector of other initial training data to obtain a correlation matrix between each initial training data and other initial training data;

[0084] In one embodiment, the element corresponding to the correlation matrix between the i-th initial training data and the j-th initial training data is α i,j .

[0085] In one embodiment, the correlation matrix between each of the initial training data and other initial training data can be expressed by the following mathematical expression:

[0086] α i,j =q i ·k j ;

[0087] Among them, q i is the query vector of the i-th initial training data, k j is the key vector of the jth initial training data.

[0088] In one embodiment, all α i,j The constructed matrix is ​​a correlation matrix.

[0089] In one embodiment, the elements in the correlation matrix corresponding to the other initial training data are attention parameters of each initial training data relative to the other initial training data.

[0090] Step 204 , determining that the elements in the correlation matrix corresponding to the other initial training data are attention parameters of each initial training data relative to the other initial training data.

[0091] In one embodiment, if Figure 3 As shown, based on the description of step 204, step 103 includes:

[0092] Step 301, summing the attention parameters of each of the initial training data relative to other initial training data to obtain a first sum value;

[0093] In one embodiment, the first sum can be expressed as follows using a mathematical expression:

[0094] Step 302, performing softmax processing or relu processing on the first sum value to obtain a preprocessed first sum value;

[0095] In one embodiment, the first sum value after preprocessing can be expressed as follows:

[0096] Step 303: multiply the preprocessed first sum value by the value vector of the corresponding initial training data to obtain preprocessed data corresponding to each initial training data.

[0097] In one embodiment, the preprocessed data corresponding to each of the initial training data can be expressed as follows using a mathematical expression:

[0098] In one embodiment, b i Rewritten in vector form O = V·A′; where b i =O,V=v i , A′=a′ i,j .

[0099] In order to obtain a classification result with higher detection accuracy, the present disclosure also provides a data detection method, such as Figure 4 As shown; the data detection method provided by the present disclosure includes:

[0100] Step 401, obtaining data to be detected;

[0101] In one embodiment, the data to be detected refers to query data that needs to be judged as abnormal data or normal data.

[0102] Step 402, classifying the data to be detected using a first classification model to obtain a classification result of the data to be detected;

[0103] In one embodiment, the first classification model refers to the one obtained by training the second classification model using the target training data generated by the data generation model provided by the present disclosure; the classification result is normal data or abnormal data.

[0104] In one embodiment, the second classification model may be any classification model, which is not limited in the present disclosure.

[0105] In one embodiment, the first classification model adopts a VAGMM model, and the fully connected layer of the VAGMM model adopts a GRU encoding layer.

[0106] In one embodiment, during the encoding and decoding process of the data to be detected, the GRU encoding layer retains the important part of the state information of the previous moment and ignores the unimportant part through the update gate and reset gate structure of the GRU encoding layer, thereby comprehensively obtaining the state information of the current moment. Compared with the traditional autoencoder model, the feature extraction is richer, and the coherence of the time series information transmission is guaranteed, avoiding the omission of important data features.

[0107] The training formula of the GRU model is as follows:

[0108] r t =σ(W t ·[h t-1 ,x t ]);

[0109] z t =σ(Wz z ·[h t-1 ,x t ]);

[0110]

[0111] Among them, x t is the input vector at the current moment; h t and h t-1 are the state memory variables of the current moment and the previous moment respectively; r t and z t They are reset door status and update door status respectively.

[0112] In order to implement the data generation method provided by the embodiment of the present disclosure, the embodiment of the present disclosure also provides a data generation device. Figure 5As shown, the data generating device 500 includes:

[0113] An initial training data acquisition unit 501 is used to acquire at least two initial training data, wherein the initial training data includes normal query data and abnormal query data;

[0114] An attention parameter acquisition unit 502 is used to acquire an attention parameter of each of the initial training data relative to other initial training data based on a correlation matrix between different initial training data; the correlation matrix is ​​used to indicate the correlation between different initial training data;

[0115] A preprocessing data acquisition unit 503 is used to preprocess each corresponding initial training data using the attention parameter of each initial training data relative to other initial training data to obtain preprocessing data corresponding to each initial training data;

[0116] The target training data acquisition unit 504 is used to diffuse the pre-processed training data using a stable diffusion model to obtain target training data.

[0117] In one embodiment, the attention parameter acquisition unit 502 is specifically used to:

[0118] Obtaining a query vector, a key vector, and a value vector for each of the initial training data;

[0119] Using the preset query vector weight, key vector weight and value vector weight, weighting the query vector, the key vector and the value vector respectively, to obtain the query vector, the key vector and the value vector after weighting each of the initial training data;

[0120] Multiplying the weighted query vector and the key vector of each initial training data with the weighted query vector and the key vector of other initial training data to obtain a correlation matrix between each initial training data and other initial training data;

[0121] Determine in the correlation matrix that the elements corresponding to the other initial training data are attention parameters of each initial training data relative to the other initial training data.

[0122] In one embodiment, the preprocessing data acquisition unit 503 is specifically used to:

[0123] Sum the attention parameters of each of the initial training data relative to other initial training data to obtain a first sum value;

[0124] Performing softmax processing or relu processing on the first sum value to obtain a preprocessed first sum value;

[0125] The preprocessed first sum value is multiplied by the value vector of the corresponding initial training data to obtain preprocessed data corresponding to each initial training data.

[0126] In order to implement the data detection method provided by the embodiment of the present disclosure, the embodiment of the present disclosure also provides a data detection device. Figure 6 As shown, the data detection device 600 includes:

[0127] The to-be-detected data acquisition unit 601 is used to acquire the to-be-detected data;

[0128] The classification result acquisition unit 602 is used to classify the data to be detected using a first classification model to obtain a classification result of the data to be detected; wherein the first classification model refers to a model obtained by training a second classification model using the target training data described in any one of claims 1 to 3; and the classification result is normal data or abnormal data.

[0129] In one embodiment, the first classification model adopts a VAGMM model, and the fully connected layer of the VAGMM model adopts a GRU encoding layer.

[0130] It should be noted that: when the data processing device provided in the above embodiment performs data processing, only the division of the above program modules is used as an example. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the data processing device is divided into different program modules to complete all or part of the processing described above. In addition, the data processing device provided in the above embodiment and the data processing method embodiment provided in the embodiment of the present disclosure belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0131] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure is shown in FIG. Figure 7 As shown, the electronic device 700 includes at least one processor 702; and a memory 701 communicatively connected to the at least one processor 702; wherein the memory 701 stores instructions executable by the at least one processor 702, and the instructions are executed by the at least one processor 702 to implement the steps of the data processing method described in the embodiment of the present disclosure.

[0132] Optionally, the electronic device may specifically be a data processing device in an embodiment of the present application, and the electronic device may implement the corresponding processes implemented by the data processing device in each method in the embodiment of the present application, which will not be described in detail here for the sake of brevity.

[0133] It is understood that the electronic device also includes a communication interface 703. The various components in the electronic device are coupled together through a bus system 704. It is understood that the bus system 704 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 704 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 7 Various buses are labeled as bus system 704 .

[0134] It can be understood that the memory 701 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 701 described in the embodiment of the present invention is intended to include but is not limited to these and any other suitable types of memories.

[0135] The method disclosed in the above embodiment of the present disclosure can be applied to the processor 702, or implemented by the processor 702. The processor 702 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 702 or an instruction in the form of software. The above processor 702 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 702 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. A general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present invention, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 701, and the processor 702 reads the information in the memory 701 and completes the steps of the above method in combination with its hardware.

[0136] In an exemplary embodiment, the electronic device may be implemented by one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), FPGAs, general purpose processors, controllers, MCUs, microprocessors, or other electronic components to execute the aforementioned method.

[0137] The embodiment of the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to implement the steps of the aforementioned method when executed.

[0138] The embodiment of the present disclosure further provides a computer program product, characterized in that it includes a computer program, and the computer program implements the steps of the aforementioned method when executed by a processor.

[0139] Optionally, the computer-readable storage medium can be applied to the data generating device or the data detecting device in the embodiments of the present application, and the computer instructions enable the computer to execute the corresponding processes implemented by the data generating device or the data detecting device in the various methods of the embodiments of the present application. For the sake of brevity, they will not be repeated here.

[0140] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0141] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple model units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0142] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0143] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.

[0144] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a model device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0145] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A data generation method, characterized in that: include: Acquire at least two initial training data, wherein the initial training data includes normal query data and abnormal query data; Based on the correlation matrix between different initial training data, obtaining the attention parameter of each initial training data relative to other initial training data; The correlation matrix is ​​used to indicate the correlation between different initial training data; Preprocessing each corresponding initial training data using the attention parameter of each initial training data relative to other initial training data to obtain preprocessed data corresponding to each initial training data; The pre-processed training data is diffused using a stable diffusion model to obtain target training data.

2. The method according to claim 1, characterized in that The step of obtaining the attention parameter of each of the initial training data relative to other initial training data based on the correlation matrix between different initial training data includes: Obtaining a query vector, a key vector, and a value vector for each of the initial training data; Using the preset query vector weight, key vector weight and value vector weight, weighting the query vector, the key vector and the value vector respectively, to obtain the query vector, the key vector and the value vector after weighting each of the initial training data; Multiplying the weighted query vector and the key vector of each initial training data with the weighted query vector and the key vector of other initial training data to obtain a correlation matrix between each initial training data and other initial training data; Determine in the correlation matrix that the elements corresponding to the other initial training data are attention parameters of each initial training data relative to the other initial training data.

3. The method according to claim 2, characterized in that The preprocessing of each corresponding initial training data using the attention parameter of each initial training data relative to other initial training data to obtain preprocessed data corresponding to each initial training data includes: Sum the attention parameters of each of the initial training data relative to other initial training data to obtain a first sum value; Performing softmax processing or relu processing on the first sum value to obtain a preprocessed first sum value; The preprocessed first sum value is multiplied by the value vector of the corresponding initial training data to obtain preprocessed data corresponding to each initial training data.

4. A data detection method, characterized in that: include: Obtain the data to be tested; The data to be detected is classified using a first classification model to obtain a classification result of the data to be detected; wherein the first classification model refers to a model obtained by training a second classification model using the target training data described in any one of claims 1 to 3; and the classification result is normal data or abnormal data.

5. The method according to claim 4, characterized in that The first classification model adopts a VAGMM model, and the fully connected layer of the VAGMM model adopts a GRU encoding layer.

6. A data generating device, characterized in that: include: An initial training data acquisition unit, used to acquire at least two initial training data, wherein the initial training data includes normal query data and abnormal query data; an attention parameter acquisition unit, configured to acquire an attention parameter of each of the initial training data relative to other of the initial training data based on a correlation matrix between different of the initial training data; The correlation matrix is ​​used to indicate the correlation between different initial training data; A preprocessing data acquisition unit, used to preprocess each corresponding initial training data using the attention parameter of each initial training data relative to other initial training data, to obtain preprocessing data corresponding to each initial training data; The target training data acquisition unit is used to diffuse the pre-processed training data using a stable diffusion model to obtain target training data.

7. A data detection device, characterized in that: include: A data acquisition unit for detecting, used for acquiring data for detecting; A classification result acquisition unit, used to classify the data to be detected using a first classification model to obtain a classification result of the data to be detected; wherein the first classification model refers to a model obtained by training a second classification model using the target training data described in any one of claims 1 to 3; and the classification result is normal data or abnormal data.

8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 3 or claims 4 to 5.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method of any one of claims 1 to 3 or claims 4 to 5.

10. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 3 or claims 4 to 5.