Epileptic eeg data augmentation method and device based on exponential power diffusion model
By using adaptive parameter settings based on an exponential power diffusion model and a U-Net network, the problem of large distribution gaps in epilepsy EEG data augmentation in existing technologies is solved, achieving high-quality data augmentation and feature preservation, and improving the reliability and diversity of epilepsy EEG data.
Patent Information
- Application Number
- CN202510734935.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-06-04
AI Technical Summary
In existing technologies, diffusion models based on Gaussian distributions are difficult to effectively capture the complex features of epileptic EEG data, resulting in a large discrepancy between the generated data distribution and the real data distribution, and the generated data lacks diversity and stability.
By adopting an exponential power diffusion model, forward diffusion and backward denoising modules are constructed through adaptive setting of shape parameters. The optimal shape parameters are estimated using maximum likelihood estimation and quasi-Newton optimization algorithms. Combined with U-Net network and Bayes' theorem, efficient augmentation of epileptic EEG data is achieved.
The generated new EEG data is highly similar to the distribution of real data, which improves the quality and stability of data expansion, solves the problem of insufficient data volume, and can accurately characterize the EEG data features of different stages of epileptic seizures.
Smart Images

Figure CN120260962B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of epilepsy detection, and particularly relates to an epilepsy electroencephalogram data expansion method and device based on an exponential power diffusion model. BACKGROUND
[0002] Epilepsy is a common chronic neurological disease with extremely complex seizure mechanisms, involving abnormal firing of neurons in the brain. Although electroencephalogram (EEG) as an efficient detection tool has been widely used in epilepsy seizure prediction, the characteristics of high dimensionality, nonlinearity, high individual difference and difficulty in obtaining of EEG signals make the existing epilepsy data set have the problems of complex feature distribution and insufficient data volume, which further leads to the difficulty of existing epilepsy prediction methods to achieve the expected clinical use.
[0003] In order to break through the data bottleneck in the field of epilepsy prediction, researchers have proposed different generative models for epilepsy electroencephalogram data expansion, especially variational autoencoder (VAE) and generative adversarial networks (GAN). However, these generative models are limited by their model architecture and optimization function, making it difficult to handle complex data, and the generated data often lacks diversity. Specifically, VAE learns the latent distribution of data by optimizing the evidence lower bound (ELBO), and samples from the latent space when generating data. Since the latent space is usually low-dimensional and continuous, the model tends to generate smooth but limited diversity data, and often has limited performance when facing high-dimensional complex data. While GAN generates data through the adversarial training of generator and discriminator, the generator tends to generate samples that can deceive the discriminator, which may lead to mode collapse, i.e. the generator only generates a few samples, lacking diversity, and GAN often exhibits unstable performance during training. In recent years, diffusion models have made significant achievements in image generation, speech synthesis and biological signal processing, and have become an important direction in generative model research and a main method for data expansion. However, applying diffusion models directly to epilepsy electroencephalogram data expansion tasks still faces many problems. Due to the high dimensionality, complexity and individual difference of electroencephalogram data, its true feature distribution is often difficult to capture and model. Traditional diffusion models based on Gaussian distribution assume that data follows a simple probability distribution, however, simple Gaussian distribution cannot fully model complex electroencephalogram signals, resulting in a large gap between the generated data distribution and the true data distribution. SUMMARY
[0004] Therefore, the application provides an epilepsy electroencephalogram data expansion method and device based on an exponential power diffusion model to solve the problem that simple Gaussian distribution cannot sufficiently model complex electroencephalogram signals in the prior art, resulting in a large difference between the generated data distribution and the real data distribution.
[0005] In a first aspect, the application provides an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model, which comprises:
[0006] setting the optimal shape parameter of the exponential power distribution;
[0007] constructing a forward diffusion module based on the exponential power distribution and a reverse denoising module based on the exponential power distribution based on the optimal shape parameter;
[0008] performing forward diffusion on the forward diffusion module based on the exponential power distribution based on the pre-acquired original electroencephalogram data to obtain noise data;
[0009] training the reverse denoising module based on the exponential power distribution based on the forward diffusion noise data to obtain a trained exponential power diffusion model;
[0010] sampling the preset probability density function of the exponential power distribution to generate noise data subject to Gaussian distribution, and inputting the noise data subject to Gaussian distribution into the reverse denoising module of the exponential power diffusion model to gradually reconstruct new electroencephalogram data.
[0011] The epilepsy electroencephalogram data expansion method based on the exponential power diffusion model provided by the application can adaptively fit the complex distribution characteristics of the epilepsy electroencephalogram data by setting the optimal shape parameter of the exponential power distribution, and is more accurate in describing the electroencephalogram data at different stages such as the interictal period, the preictal period, the ictal period and the postictal period than the traditional fixed parameter model, effectively retains the characteristic information of the original data, and improves the quality and effectiveness of data expansion. The forward diffusion module and the reverse denoising module are constructed based on the optimal shape parameter, the forward diffusion module can add controllable noise to the data, the reverse denoising module can efficiently learn the data distribution pattern, has stronger feature extraction and recovery capability when reconstructing the original data, and the performance of the entire exponential power diffusion model is significantly improved, and the stability and reliability are higher. The noise data is obtained by performing forward diffusion based on the original electroencephalogram data, and the reverse denoising module is trained based on the noise data, the entire training process fully utilizes the information of the original data, the trained exponential power diffusion model can reconstruct a large amount of high-quality new electroencephalogram data from the preset probability density function of the exponential power distribution, models the complex electroencephalogram signal, effectively solves the problem of insufficient epilepsy electroencephalogram data samples, the new electroencephalogram data generated by the method is highly similar to the real data distribution, solves the problem that simple Gaussian distribution cannot sufficiently model complex electroencephalogram signals in the prior art, resulting in a large difference between the generated data distribution and the real data distribution.
[0012] In an optional implementation, the optimal shape parameter of the exponential power distribution is set, comprising:
[0013] The optimal shape parameter of the input data is adaptively estimated based on the maximum likelihood estimation method and the quasi-Newton optimization algorithm.
[0014] In an optional implementation, the optimal shape parameter of the input data is adaptively estimated based on the maximum likelihood estimation method and the quasi-Newton optimization algorithm, comprising:
[0015] The probability density function of the exponential power distribution is set;
[0016] The maximum likelihood function is calculated based on the probability density function and the pre-acquired original electroencephalogram data using the maximum likelihood estimation method, and the logarithmic likelihood function corresponding to the maximum likelihood function is calculated;
[0017] The logarithmic likelihood function is equivalent to an unconstrained optimization problem, and the quasi-Newton optimization algorithm is used to solve the unconstrained optimization problem to obtain the optimal shape parameter of the input data.
[0018] The present application provides an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model. By setting the probability density function of the exponential power distribution, combining the maximum likelihood function and the logarithmic likelihood function calculated by the maximum likelihood estimation method, the potential distribution rule of the epilepsy electroencephalogram data can be fully tapped. Unlike traditional fixed parameter setting, this method can dynamically adjust the shape parameter according to the characteristics of the original electroencephalogram data, so that the exponential power distribution can better fit the complex distribution of epilepsy electroencephalogram data in different stages such as interictal period and ictal period, and accurately describe the data characteristics, laying a solid foundation for subsequent data processing and model construction. The logarithmic likelihood function is converted into an unconstrained optimization problem, and the quasi-Newton optimization algorithm is used to solve it, avoiding the problems of high computational complexity and slow convergence speed that may exist in traditional optimization algorithms. The optimal shape parameter adaptively estimated can enhance the expression ability of the exponential power diffusion model for epilepsy electroencephalogram data. The forward diffusion and reverse denoising modules constructed based on this parameter can more accurately simulate the real changes of the data during the data diffusion and denoising reconstruction process, effectively preserve the data characteristics, thereby improving the stability and reliability of the exponential power diffusion model, and ultimately generate high-quality expanded electroencephalogram data, providing stronger data support for the research and clinical diagnosis of epilepsy.
[0019] In an optional implementation, a forward diffusion module based on the exponential power distribution is constructed based on the optimal shape parameter, comprising:
[0020] The Markov chain of the forward process is specified, the time step of the forward diffusion is set, and the input data sample is constructed based on the pre-acquired original electroencephalogram data;
[0021] Based on the Markov chain, a scheduling strategy is used to generate a constant sequence for controlling the mean and variance of the exponential power distribution corresponding to the time step within the time step;
[0022] A forward diffusion process with a preset number of steps is constructed, and based on the optimal shape parameter, exponential power noise controlled by the constant sequence is gradually added to the input data sample in each step, so that the input data sample is converted into a sample sequence subject to an exponential power distribution after the above time step, and an exponential power distribution-based forward diffusion module is obtained.
[0023] The present application provides an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model, specifies the Markov chain of the forward process and sets the time step, can decompose the diffusion process of the data into an ordered discrete step, so that the data change of each step follows a specific rule and has high predictability. This controllable diffusion process avoids irregular changes in data during processing, ensures the stability and consistency of data during diffusion, and facilitates analysis and control of the data diffusion process. Based on the optimal shape parameter, the input data sample is subject to an exponential power distribution after the above time step by combining the scheduling strategy. Since the optimal shape parameter is adaptively estimated from the original electroencephalogram data, it can accurately fit the data distribution, so the input data sample and the added noise can more realistically simulate the changes of epilepsy electroencephalogram data in practice. Compared with the traditional diffusion method, this method can more accurately capture the data characteristics, so that the diffused data is more consistent with the inherent distribution rule of the original data, improving the quality of data expansion. A forward diffusion process with a preset number of steps is constructed to ensure the standardization and consistency of the data processing flow. Based on the optimal shape parameter, noise is added to ensure that the forward diffusion module and the reverse denoising module are highly consistent in data feature processing. In the subsequent model training and data reconstruction process, this stability helps to reduce the fluctuations of model training, speeds up the model convergence speed, improves the overall performance of the exponential power diffusion model, and thus generates more reliable expanded electroencephalogram data.
[0024] In an optional embodiment, a forward diffusion process with a preset number of steps is constructed, and based on the optimal shape parameter, exponential power noise controlled by the constant sequence is gradually added to the input data sample in each step, so that the input data sample is converted into a sample sequence subject to an exponential power distribution after the above time step, and an exponential power distribution-based forward diffusion module is obtained, comprising:
[0025] The sample sequence obtained by gradually adding exponential power noise in the forward diffusion process is introduced into the reparameterization technique, and the sample sequence subject to the exponential power distribution is reconstructed into a form conforming to the gamma distribution and the uniform distribution;
[0026] Converting the exponential power distribution into a re-expression form of noise sampled from a uniform distribution after linear scaling and translation;
[0027] Calculating the mean and variance of the specified sub-item in the re-expression form, and calculating the relationship from the starting time to any time in the forward diffusion process based on the Lyapunov Central Limit Theorem, and taking the relationship as the forward diffusion module based on the exponential power distribution.
[0028] The reparameterization technology reconstructs the exponential power distribution into the form of gamma distribution and uniform distribution, which can directly sample from the standard distribution, avoiding complex numerical calculation and greatly improving the sampling efficiency. Linear scaling and translation convert the exponential power distribution into the form of uniform distribution sampling after linear transformation, further simplifying the calculation process and reducing the calculation complexity, making the implementation of the forward diffusion process more efficient. By converting the exponential power distribution into the linear transformation of the uniform distribution, the model has stronger adaptability to different data characteristics. When processing epilepsy electroencephalogram data with complex distribution characteristics, the model can more accurately capture the data characteristics and improve the flexibility and adaptability of the model. The relationship obtained based on the Lyapunov Central Limit Theorem provides a more intuitive basis for adjusting the model parameters. The model parameters can be flexibly adjusted according to actual needs to optimize the performance of the model. The relationship from the starting time to any time is derived based on the Lyapunov Central Limit Theorem, which provides a solid theoretical support for the forward diffusion process. The obtained relationship clearly expresses the change rule of the data in the diffusion process, which is convenient for analyzing and understanding the model, and provides a theoretical guidance for optimizing and improving the model.
[0029] In an optional embodiment, the reverse denoising module based on the exponential power distribution is constructed based on the optimal shape parameter, including:
[0030] The pre-acquired original electroencephalogram data is input into the forward diffusion module based on the exponential power distribution for forward diffusion to obtain noise data;
[0031] The forward diffusion module based on the exponential power distribution is constructed to encode the time step information of the U-Net network, the noise data is input into the U-Net network, the distribution pattern of the noise data is learned through the multi-layer convolution and down-sampling, up-sampling structure, and the residual connection and attention mechanism are added to the U-Net network, and at the same time the time step information is integrated into each layer of the U-Net network through the time embedding layer, to obtain the output of the U-Net network.
[0032] Based on the output of the U-Net network, a reverse denoising process with a preset number of steps is constructed, and based on the optimal shape parameter, noise is continuously removed from random noise at each time step according to the exponential power distribution, to obtain the reverse denoising module based on the exponential power distribution.
[0033] The application provides an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model. The exponential power distribution is customized by an optimal shape parameter, so that the reverse denoising process is more in line with the actual distribution characteristics of the epilepsy electroencephalogram data, and the noise can be more accurately identified and removed, and the characteristics of the real electroencephalogram signal are retained. The encoder and decoder architecture formed by the multi-layer convolution and the down-sampling-up-sampling structure can capture the electroencephalogram signal characteristics of different scales, from the microscopic waveform details to the macroscopic time sequence mode, and can be effectively processed. The residual connection, attention mechanism and time embedding layer enhance the feature extraction capability of the U-Net network, the reverse process of the preset step corresponds to the time step of the forward diffusion, forming a clear denoising path, and ensuring that the process of gradually recovering the original signal from the noise data is controllable and stable. The noise is removed according to the exponential power distribution in each time step, and a theoretical closed loop is formed with the forward diffusion process, ensuring the mathematical consistency and physical meaning of the denoising process. The noise data generated by the forward diffusion is directly used as the input of the reverse denoising, and the two modules are constructed based on the same exponential power distribution framework, seamlessly connected, and the data conversion error is reduced. The exponential power distribution can better describe the spike thick-tailed characteristics of the electroencephalogram signal, especially the abnormal discharge mode during the epilepsy seizure period, and has more advantages than the traditional Gaussian distribution.
[0034] In an optional implementation, a reverse denoising process with a preset number of steps is constructed based on the output of the U-Net network, and noise is continuously removed from random noise according to an exponential power distribution at each time step based on the optimal shape parameter, to obtain an exponential power distribution-based reverse denoising module, including:
[0035] A learning model is constructed to learn the first conditional probability of the exponential power distribution, and the second conditional probability is calculated based on the first conditional probability and the starting time sampling data point by using the Bayes formula;
[0036] The preset number of exponential power distributions obtained in the forward diffusion is substituted into the Bayes formula to obtain a transformed form of the second conditional probability;
[0037] Based on the transformed form of the second conditional probability and the standard exponential power distribution, the analytical expressions of the corresponding mean and variance are obtained, and the expression of the starting time sampling data point is obtained based on the derivation process of the forward diffusion process;
[0038] The expression of the starting time sampling data point is substituted into the analytical expressions of the mean and variance again to obtain the exponential power distribution-based reverse denoising module.
[0039] The application provides an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model, a strict mathematical framework is established by learning the conditional probability of the exponential power distribution and applying the Bayes formula, so that the reverse denoising process has a solid theoretical basis. The analytical expressions of the mean and variance are derived from the exponential power distribution, which avoids complex numerical calculations and improves the interpretability and accuracy of the model. The preset number of exponential power distributions is substituted into the Bayes formula to obtain a transformed form, which realizes form optimization, simplifies the calculation process, reduces the calculation amount, and makes the model more efficient in processing large-scale electroencephalogram data. Compared with the sampling-based method, the analytical expression directly gives the calculation method of the mean and variance, without the need for a large number of sampling and iteration, which significantly improves the speed of reverse denoising. The exponential power distribution is customized based on the optimal shape parameter, so that the model can better adapt to the non-Gaussian characteristics of the epilepsy electroencephalogram data, and the accuracy of noise removal is improved. Through the derivation of the forward diffusion process, the expression of the sampling data point at the starting time is obtained, and is substituted into the mean and variance expressions, which ensures the time sequence consistency of the reverse denoising process and the forward diffusion, so that the reconstructed data is more in line with the physiological law. The noise data distribution pattern learned by the U-Net network is combined with the Bayes derivation, which fully utilizes the feature extraction capability of the network and improves the recognition and recovery capability of the epilepsy-specific pattern.
[0040] In a second aspect, the application provides an epilepsy electroencephalogram data expansion device based on an exponential power diffusion model, which comprises:
[0041] An optimal shape parameter setting module is configured to set the optimal shape parameter of the exponential power distribution.
[0042] An exponential power diffusion model construction module is configured to construct a forward diffusion module based on the exponential power distribution and a reverse denoising module based on the exponential power distribution based on the optimal shape parameter.
[0043] A forward diffusion module is configured to perform forward diffusion on the forward diffusion module based on the exponential power distribution based on the pre-acquired original electroencephalogram data to obtain noise data.
[0044] A reverse denoising module is configured to train the reverse denoising module based on the exponential power distribution based on the noise data obtained by the forward diffusion to obtain a trained exponential power diffusion model.
[0045] A reconstruction expansion module is configured to sample the probability density function of the preset exponential power distribution to generate noise data subject to a Gaussian distribution, and input the noise data subject to the Gaussian distribution into the reverse denoising module of the exponential power diffusion model to gradually reconstruct new electroencephalogram data.
[0046] In a third aspect, the present application provides a computer device, comprising a memory and a processor, which are communicatively connected with each other, and the memory stores computer instructions, and the processor executes the computer instructions to perform the epilepsy electroencephalogram data augmentation method based on the exponential power diffusion model according to the first aspect or any one of the corresponding embodiments thereof.
[0047] In a fourth aspect, the present application provides a computer readable storage medium, which stores computer instructions for making a computer execute the epilepsy electroencephalogram data augmentation method based on the exponential power diffusion model according to the first aspect or any one of the corresponding embodiments thereof.
[0048] In a fifth aspect, the present application provides a computer program product, which comprises computer instructions for making a computer execute the epilepsy electroencephalogram data augmentation method based on the exponential power diffusion model according to the first aspect or any one of the corresponding embodiments thereof. BRIEF DESCRIPTION OF DRAWINGS
[0049] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings required to be used in the specific embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0050] Figure 1 is a flowchart of the epilepsy electroencephalogram data augmentation method based on the exponential power diffusion model according to an embodiment of the present application;
[0051] Figure 2 is a flowchart of another epilepsy electroencephalogram data augmentation method based on the exponential power diffusion model according to an embodiment of the present application;
[0052] Figure 3 is a flowchart of still another epilepsy electroencephalogram data augmentation method based on the exponential power diffusion model according to an embodiment of the present application;
[0053] Figure 4 is a schematic diagram of the forward diffusion and reverse denoising process according to an embodiment of the present application;
[0054] Figure 5 is a schematic diagram of another forward diffusion and reverse denoising process according to an embodiment of the present application;
[0055] Figure 6 is a schematic diagram of the U-Net network structure in the reverse denoising module based on the exponential power diffusion model according to an embodiment of the present application;
[0056] Figure 7is a U-Net network workflow schematic diagram according to an embodiment of the present application;
[0057] Figure 8 is a seizure electroencephalogram data waveform schematic diagram generated according to an exponential power diffusion model according to an embodiment of the present application;
[0058] Figure 9 is a non-seizure electroencephalogram data waveform schematic diagram generated according to an exponential power diffusion model according to an embodiment of the present application;
[0059] Figure 10 is a structural block diagram of an epilepsy electroencephalogram data augmentation device based on an exponential power diffusion model according to an embodiment of the present application;
[0060] Figure 11 is a hardware structure schematic diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION
[0061] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.
[0062] First, the principle of the classic diffusion model is briefly introduced here. The classic diffusion model proposed by Jonathan Ho is based on Gaussian distribution and a series of mathematical properties thereof, and two core processes of the classic diffusion model are forward diffusion and reverse denoising process. In the Markov chain in the forward diffusion process, Jonathan Ho gradually adds Gaussian noise in each time step, so that after T time steps, the original true data approaches a random Gaussian noise, that is, the original data after T time steps obeys Gaussian distribution, and the model learns the Gaussian noise added in each time step. In the reverse denoising process, the model predicts the Gaussian noise added in the forward process in each time step according to the learned pattern, and according to the predicted noise of the model, a series of mathematical transformations are performed to continuously denoise, and finally the original data is restored.
[0063] According to the above process, it can be seen that the Gaussian distribution is the core component of the two processes of the diffusion model, whether it is forward diffusion or backward denoising, and the mathematical principle of the Gaussian distribution cannot be separated. And there is an important assumption in the diffusion model, that is, the feature distribution of the original data obeys the Gaussian distribution, which is mainly reflected in that the data can be continuously denoised from random Gaussian noise. When processing natural image data, the feature distribution of the image is close to the Gaussian distribution, which makes this assumption possible, that is, the diffusion model based on the Gaussian distribution has a high performance when processing image tasks. However, when facing some more complex data sets, such as the epilepsy electroencephalogram data set mentioned in the present application, the simple Gaussian distribution often no longer has the ability to accurately capture the characteristics of the data, which makes it necessary to use a distribution mode with stronger and more flexible modeling capability, that is, the core technical innovation point of the present application is introduced-the diffusion model based on exponential power distribution.
[0064] The embodiment of the present application provides an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model, wherein the exponential power distribution is also called power exponential distribution. Compared with the Gaussian distribution in the classical diffusion model in the prior art, the exponential power distribution introduces a shape parameter, so that it has a more flexible form and stronger modeling capability. The embodiment of the present application effectively improves the modeling capability of the diffusion model for real complex data by reconstructing the core formulas of forward diffusion and backward denoising, and uses the diffusion model based on the exponential power distribution (referred to as the exponential power diffusion model) in the epilepsy electroencephalogram data expansion task with complex feature distribution, solves the problem that the simple Gaussian distribution in the prior art cannot sufficiently model the complex electroencephalogram signal, resulting in a large difference between the generated data distribution and the real data distribution, and can also solve the problems of uneven class distribution, low data quality, small scale and the like commonly existing in existing data sets.
[0065] According to the embodiment of the present application, an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0066] In the present embodiment, an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model is provided, which can be used in the computer device described above, Figure 1 The flowchart of the epilepsy electroencephalogram data expansion method based on the exponential power diffusion model according to the embodiment of the present application is shown in Figure 1 As shown in the figure, the flowchart includes the following steps:
[0067] Step S101, set the optimal shape parameter of the exponential power distribution.
[0068] Specifically, the shape parameter of the Exponential Power distribution (EP) refers to a numerical parameter that affects the shape of the distribution. The optimal shape parameter not only affects the shape of the distribution, but also determines the concentration and tail thickness of the Exponential Power distribution, such as sharp thick tails or flat thin tails. The adaptive parameter method is used to adaptively estimate the optimal shape parameter of the input data The optimal shape parameter is closely related to the probability density function of the Exponential Power distribution, and improves the description ability of the Exponential Power diffusion model for input data.
[0069] Step S102, constructing an Exponential Power distribution-based forward diffusion module and an Exponential Power distribution-based reverse denoising module based on the optimal shape parameter.
[0070] Specifically, the Exponential Power distribution-based forward diffusion module refers to the process of gradually adding noise to the data in the forward diffusion process, and finally becoming Gaussian noise. Specifically, the forward diffusion process is to gradually add noise to the data through a series of mathematical models until the data distribution approaches a standard Gaussian distribution.
[0071] The Exponential Power distribution-based reverse noise module is the inverse process of the forward diffusion process, and the purpose is to recover data from noise. The Exponential Power distribution-based reverse noise module includes a U-Net network, which uses the results of the forward diffusion as data for the reverse noise module, and finally reconstructs the original data from the noisy data.
[0072] Step S103, based on the pre-acquired original electroencephalogram data, the Exponential Power distribution-based forward diffusion module is subjected to forward diffusion to obtain noise data.
[0073] Specifically, the pre-acquired original electroencephalogram data is the electroencephalogram data collected and recorded during the interictal period, preictal period, ictal period and postictal period of each patient. Before inputting the original electroencephalogram data into the Exponential Power distribution-based forward diffusion module, the original electroencephalogram data needs to be preprocessed, including:
[0074] The original electroencephalogram data is resampled at a sampling frequency determined as needed, such as 512Hz or 256Hz, and then a sliding window is used to cut out segments at a certain time step, the window size is determined as needed, such as 1s, 10s, 30s, etc., and the cut segments are classified and stored.
[0075] The input of the exponential power diffusion model (including the forward diffusion module based on the exponential power distribution and the reverse noise module based on the exponential power distribution) is constructed according to the period to which the activity of the preprocessed EEG data belongs, i.e., the interictal period, the preictal period, the ictal period and the postictal period, the type of data that needs to be expanded is selected, and the data of this category completed by the preprocessing step is loaded. Further data processing before inputting the model: (1) using Min-Max method for data normalization; (2) padding or truncating the data in the channel dimension to ensure the consistency of the data size. The input data (B, L, C, D) of the exponential power diffusion model is obtained, where B is the batch size, L is the segment length, C is the number of channels, and D is the feature dimension (determined by the sampling frequency).
[0076] The original EEG segment for data processing is input into the forward diffusion module based on the exponential power distribution, the forward diffusion module based on the exponential power distribution is trained for forward diffusion, and finally the noise data is obtained.
[0077] Step S104, training the reverse denoising module based on the exponential power distribution based on the noise data of the forward diffusion, obtaining the trained exponential power diffusion model.
[0078] Specifically, the output result of the forward diffusion module based on the exponential power distribution, i.e., the noise data, is input into the reverse denoising module based on the exponential power distribution to train the reverse denoising module based on the exponential power distribution, i.e., the noise data is input into the U-Net network of the reverse denoising module based on the exponential power distribution, and the U-Net network is trained. After T times of denoising iteration, the trained exponential power diffusion model and the newly generated denoising data are obtained .
[0079] Step S105, sampling the probability density function of the preset exponential power distribution to generate noise data subject to the exponential power distribution, and inputting the noise data subject to the exponential power distribution into the reverse denoising module of the exponential power diffusion model to gradually reconstruct new EEG data.
[0080] Specifically, load the trained exponential power diffusion model, sample the exponential power distribution through the forward diffusion module in the exponential power diffusion model to obtain a large amount of noise data subject to the exponential power distribution, input these noise data into the exponential power diffusion model, and through the sampling module in the reverse denoising module, a large amount of high-quality epileptic EEG data is reconstructed by denoising.
[0081] The epilepsy electroencephalogram data expansion method based on the exponential power diffusion model provided in the embodiment can adaptively fit the complex distribution characteristics of epilepsy electroencephalogram data by setting the optimal shape parameter of the exponential power distribution, and is more accurate in describing the electroencephalogram data in different stages such as interictal period, preictal period, ictal period and postictal period than the traditional fixed parameter model, effectively retains the characteristic information of the original data, and improves the quality and effectiveness of data expansion. The forward diffusion and reverse denoising modules are constructed based on the optimal shape parameter. The forward diffusion module can realize controllable noise addition to the data, and the reverse denoising module can efficiently learn the data distribution mode and has stronger feature extraction and recovery capability when reconstructing the original data, so that the performance of the entire exponential power diffusion model is significantly improved, and the stability and reliability are higher. The noise data is obtained by forward diffusion based on the original electroencephalogram data, and the reverse denoising module is trained based on the noise data. The entire training process fully utilizes the information of the original data, and the trained exponential power diffusion model can reconstruct and generate a large amount of high-quality new electroencephalogram data from the preset probability density function of the exponential power distribution, realize modeling of complex electroencephalogram signals, and effectively solve the problem of insufficient epilepsy electroencephalogram data samples. The new electroencephalogram data generated by the method is highly similar to the real data distribution, solves the problem that the simple Gaussian distribution in the prior art cannot fully model the complex electroencephalogram signals, and leads to a large gap between the generated data distribution and the real data distribution.
[0082] In the embodiment, an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model is provided, which can be used in the computer device described above, Figure 2 is a flowchart of the epilepsy electroencephalogram data expansion method based on the exponential power diffusion model according to the embodiment of the present application, as Figure 2 shown, the flowchart includes the following steps:
[0083] Step S201, setting the optimal shape parameter of the exponential power distribution.
[0084] Specifically, the above step S201 includes:
[0085] Step a, adaptively estimating the optimal shape parameter of the input data based on the maximum likelihood estimation method and the quasi-Newton optimization algorithm.
[0086] In some optional embodiments, the above step a includes:
[0087] Step a1, setting the probability density function of the exponential power distribution.
[0088] First, the probability density function of the exponential power distribution is defined as:
[0089] (1);
[0090] wherein, is a gamma function, is a central moment parameter, is a mean parameter, is a shape parameter, denotes a random variable, here only the probability density function of the exponential power distribution is defined in advance.
[0091] Step a2, based on the probability density function and the pre-acquired raw electroencephalogram data, the maximum likelihood function is calculated by using the maximum likelihood estimation algorithm, and the log-likelihood function corresponding to the maximum likelihood function is calculated.
[0092] Specifically, the pre-acquired raw electroencephalogram data is obtained after data preprocessing and input data processing to obtain a data set for training, and the data set for training is , the likelihood function thereof can be calculated:
[0093] (2);
[0094] Then, the log-likelihood function thereof can be obtained:
[0095] (3);
[0096] wherein, is the sample data in the training data set; is the number of sample data.
[0097] Step a3, the log-likelihood function is equivalent to an unconstrained optimization problem, and a quasi-Newton optimization algorithm is used to solve the unconstrained optimization problem to obtain the optimal shape parameter of the input data.
[0098] Specifically, the log-likelihood function is equivalent to an unconstrained optimization problem, that is, to find the shape parameter , that is, the optimal shape parameter, which can be expressed as:
[0099] (4);
[0100] The BFGS algorithm (BFGS algorithm, a rank-2 quasi-Newton method) in the quasi-Newton method is used to solve the unconstrained optimization problem to obtain the optimal shape parameter . For specific solving steps, please refer to the related technology, which will not be repeated here.
[0101] Step S202, based on the optimal shape parameter, a forward diffusion module based on the exponential power distribution and a backward denoising module based on the exponential power distribution are constructed.
[0102] Specifically, the specific process of constructing the forward diffusion module based on the exponential power distribution based on the optimal shape parameter is as follows:
[0103] (1) Set the time step T, which is used to set the number of time steps that the model forward diffusion process needs to go through.
[0104] (2) Select a scheduling strategy, such as linear scheduling, square scheduling, or inverse time scheduling, to generate a data sequence of length T, which is used to control the noise intensity of the exponential power noise at each step in the forward diffusion process.
[0105] (3) Set the value of the shape parameter according to the adaptive parameter method in step S101, which is used to control the shape of the exponential power distribution, such as sharp thick tail or flat thin tail.
[0106] (4) Construct a forward diffusion process with T steps, and add exponential power noise to the data at each step according to the shape parameter , and the original data after T steps gets the diffused noise data .
[0107] The specific process of constructing the reverse denoising module based on the exponential power distribution based on the best shape parameter is as follows:
[0108] (1) Construct a U-Net network to encode the information of the time step , learn the distribution pattern of the input noise data through multi-layer convolution and down-sampling-up-sampling structure, and use residual connection and attention mechanism to enhance the feature extraction ability, and integrate the time step information into each layer of the network through the time embedding layer.
[0109] (2) Construct a reverse denoising process with steps, and gradually reconstruct the original data from the new denoised data according to the output of the U-Net network.
[0110] Further, the above step S202 based on the best shape parameter to construct the forward diffusion module based on the exponential power distribution, that is, the derivation and construction of the specific forward diffusion process include:
[0111] Step S2021, specify the Markov chain of the forward process, set the time step length of the forward diffusion, and construct the input data sample based on the pre-acquired original EEG data.
[0112] Specifically, given a data point We define a forward process that is a Markov chain, where the current state is determined solely by the state at the previous time step and is independent of the state at any other time step. These represent the distribution of the real data. This indicates the starting time value of the sampled data point.
[0113] Step S2022: Based on the Markov chain, a scheduling strategy is used within the time step to generate a constant sequence corresponding to the time step for controlling the mean and variance of the exponential distribution.
[0114] Specifically, in this forward diffusion process, through This process generates a series of samples. The step size is set by Given a sequence, and assuming that each step yields... ( Representing data points The data points obtained after t time steps all satisfy an exponential distribution, meaning the entire forward process simultaneously satisfies the following formula:
[0115] (5);
[0116] in, It follows an exponential power distribution. Let be the shape parameter of the exponential power distribution. This represents a conditional probability distribution, that is, given... conditions, The distribution that it follows Represents the identity matrix. Data points joint variables, Indicates that in a given conditions, The joint variables follow a distribution. This represents a hyperparameter used to control the mean and variance of the exponential distribution.
[0117] Step S2023: Construct a forward diffusion process with a preset number of steps. Based on the optimal shape parameters, in each step, exponential noise controlled by a constant sequence is gradually added to the input data sample, so that the input data sample is converted into a sample sequence that follows an exponential distribution after the above time step, thus obtaining a forward diffusion module based on an exponential distribution.
[0118] In some optional implementations, step S2023 above includes:
[0119] Step b1, the sample sequence obtained by adding exponential power noise step by step in the forward diffusion process is introduced into the reparameterization technique, and the sample sequence conforming to the exponential power distribution is reconstructed into the form conforming to the gamma distribution and the uniform distribution.
[0120] Specifically, in order to ensure that the sampling process is differentiable and can perform gradient propagation in the subsequent training process, the reparameterization technique is introduced to reconstruct the exponential power distribution into the following form:
[0121] (6);
[0122] wherein, is the gamma distribution, is the uniform distribution, , , all represent intermediate variables and have no actual meaning.
[0123] Step b2, the exponential power distribution is converted into noise sampled from the uniform distribution and then represented in the form after linear scaling and translation.
[0124] Specifically, therefore, the exponential power distribution in formula (6) can be represented in the form after linear scaling and translation of noise sampled from the uniform distribution as follows:
[0125] (7);
[0126] Let , and , , the following can be obtained:
[0127] (8);
[0128] wherein, , all represent variables conforming to the uniform distribution, , respectively represent components obtained by linear translation conversion of the corresponding intermediate variables z and through the reparameterization technique, , , all represent intermediate process quantities and have .
[0129] Step b3, the mean and variance of the specified subitem in the represented form are calculated, and the relationship from the starting time to any time in the forward diffusion process is calculated based on the Lyapunov central limit theorem, and the relationship is taken as the forward diffusion module based on the exponential power distribution.
[0130] In particular, consider the subterm in the above equation To obtain the relationship between and , the mean and variance of the subterm need to be calculated:
[0131] (9);
[0132] (10);
[0133] where represents the mean of the subterm , represents the variance of the subterm . k represents the kth subterm in all the subterms mentioned above, and k takes an integer value from 0 to t-1.
[0134] For the subterms and , consider whether the Lyapunov central limit theorem holds. Therefore, define the sum of their variances as: (11);
[0136] It is obtained that:
[0137] (12);
[0138] Next, it is necessary to verify whether it satisfies the Lyapunov condition, i.e. whether there exists such that when , it satisfies:
[0139] (13);
[0140] Let , , it can be obtained that:
[0141] (14);
[0142] It is known that the Lyapunov condition is established, i.e. the Lyapunov central limit theorem is satisfied, and let:
[0143] (15);
[0144] Then , where is a Gaussian distribution. According to the properties of the Gaussian distribution, the above equation can be written in the following form:
[0145] (16);
[0146] where .
[0147] Thus, substituting the above equation into the chain formula of the forward diffusion process, a more simplified form can be obtained as follows:
[0148] (17);
[0149] Finally, the relationship between the starting time and any time in the forward diffusion process is obtained, that is, to , and the exponential power distribution satisfies:
[0150] (18);
[0151] It can be verified that when the shape parameter , the exponential power distribution is equivalent to the standard Gaussian distribution, and the above equation (18) can be simplified as:
[0152] (19).
[0153] That is, when the shape parameter of the exponential power distribution, the exponential power distribution degenerates into the standard Gaussian distribution, and at the same time, the forward diffusion formula of the exponential power diffusion model degenerates into the formula of the forward diffusion process of the traditional diffusion model.
[0154] The above describes in detail the construction of the forward diffusion process of the exponential power diffusion model and the derivation of the core formula of the embodiment of the application from the theoretical aspect. The exponential power diffusion model not only theoretically extends the basis of the traditional diffusion model, but also provides the possibility for modeling more complex noise distribution by introducing the shape parameter p of the exponential power distribution.
[0155] Further, the construction of the reverse denoising module based on the exponential power distribution based on the optimal shape parameter in the above step S202, that is, the specific derivation and construction of the reverse denoising process include:
[0156] In step S2024, the pre-acquired original electroencephalogram data is input into the forward diffusion module based on the exponential power distribution for forward diffusion to obtain noise data.
[0157] Specifically, the forward diffusion and reverse denoising process schematic diagram is as shown in Figure 4 and Figure 5 , and the result of the forward diffusion module is taken as the input of the reverse denoising module. Figure 4 and Figure 5 X0, X1, X2, …, X T in
[0158] In step S2025, a U-Net network for encoding time step information is constructed based on the forward diffusion module of the exponential power distribution, noise data is input into the U-Net network, distribution patterns of the noise data are learned through multi-layer convolution and down-sampling and up-sampling structures, residual connections and attention mechanisms are added to the U-Net network, time step information is integrated into each layer of the U-Net network through a time embedding layer, and an output of the U-Net network is obtained.
[0159] Specifically, the U-Net network is constructed as shown in Figure 6 , a workflow of the U-Net network is as shown in Figure 7 , multi-level feature extraction is performed on the input noise data by an encoder part of the U-Net network, and global and local information of the data is gradually captured. Each layer of the encoder converts the input data into a series of high-dimensional feature representations through convolution operations and down-sampling operations. These feature representations not only contain statistical characteristics of the noise data, but also implicitly contain dynamic information of the time step .
[0160] In the decoder part, the U-Net network gradually reconstructs the features extracted by the encoder into de-noised data through up-sampling and skip connections. The role of the skip connection is to combine the low-level features of the encoder with the high-level features of the decoder, so as to retain more detailed information and avoid losing important structural features in the de-noising process. In order to further enhance the modeling ability of the model for the time step t, a time embedding mechanism is added to each layer of the U-Net. The time embedding maps the time step t into a high-dimensional vector and combines it with the input features, so that the model can dynamically adjust its parameters to adapt to different noise levels. This design enables the model to adaptively learn the distribution patterns of the noise data according to the changes in the time step t in the reverse de-noising process, thereby improving the accuracy and stability of de-noising. In addition, in order to improve the expression ability of the model, an attention mechanism is introduced in the convolution layer of the U-Net network. The attention mechanism calculates the correlation between feature maps, so that the model can better capture long-range dependencies in the data, thereby more accurately restoring the global structure of the data in the de-noising process.
[0161] In step S2026, a reverse de-noising process with a preset number of steps is constructed based on the output of the U-Net network, and noise is continuously removed from random noise according to an exponential power distribution at each time step based on the best shape parameter, to obtain a reverse de-noising module based on the exponential power distribution.
[0162] In some alternative implementations, the process of constructing the reverse denoising module of the exponential diffusion model is as follows: the reverse denoising process corresponds to the forward diffusion process, while the forward process gradually diffuses the data... Unlike adding random noise, the reverse process follows the same procedure at each time step. Exponential power distribution from random noise Noise is continuously removed during the process. However, the model cannot directly estimate... Because this requires the entire dataset, step S2026 above includes:
[0163] Step c1: Construct a learning model to learn the first conditional probability of the exponential power distribution, and calculate the second conditional probability based on the first conditional probability and the sampled data points at the initial time using Bayes' theorem.
[0164] Specifically, therefore, it is necessary to learn a model. To approximate conditional probability (First conditional probability), thus realizing the entire inverse denoising process, that is:
[0165] (19);
[0166] Although It is unknown, but with the addition of conditions back, The second conditional probability can be calculated using Bayes' theorem:
[0167] (20).
[0168] Step c2: Obtain the power distribution of a preset number of exponential powers obtained in the forward diffusion, and substitute the power distribution of the preset number of exponential powers into the Bayes formula to obtain a modified form of the second conditional probability.
[0169] Specifically, in the derivation process from step S2021 to step S2023, the following three exponential power distributions were obtained:
[0170] (twenty one);
[0171] make: Substituting the three exponential distributions of formula (21) into Bayes' formula (20), we can obtain:
[0172] (twenty two);
[0173] in, It is some that do not involve The part can be omitted. The mathematical symbol represents proportional to.
[0174] Step c3, based on the second condition probability of the transformed version and the standard exponential power distribution, the analytical expressions of the corresponding mean and variance are derived, and the expression of the sampling data point at the initial time is obtained based on the derivation process of the forward diffusion process.
[0175] Specifically, the above formula (22) is further simplified, and the analytical expressions of the mean and variance are given according to the standard exponential power distribution, which is similar to the forward diffusion module:
[0176] (23);
[0177] wherein, , respectively represent the mean and variance of the backward denoising. Step c4, the expression of the sampling data point at the initial time is substituted into the analytical expressions of the mean and variance to obtain the backward denoising module based on the exponential power distribution.
[0178] Specifically, according to the derivation process of the forward diffusion in steps S2021 to S2023, the following can be obtained:
[0179] (24);
[0180] wherein, is the output of the U-Net network.
[0181] Substituting the expression of into the expression of , the data mean and variance obtained after each denoising step in the backward denoising process can be obtained, and the noise data can be sampled and reconstructed through the mean and variance.
[0182] It can be verified that when the shape parameter of the exponential power distribution , the exponential power distribution is equivalent to the Gaussian distribution, , and The expression can be simplified as:
[0183] (25).
[0184] That is, when the shape parameter of the exponential power distribution , the exponential power distribution degenerates into the standard Gaussian distribution, and at the same time, the expressions of , and in the exponential power diffusion model also degenerate into the core formula of the backward denoising process in the traditional diffusion model.
[0185] So far, all the derivations of the core formula in the reverse denoising process of the exponential power diffusion model have been completed. By combining the forward diffusion module and the reverse denoising module, the entire exponential power diffusion model is systematically constructed.
[0186] In step S203 of the embodiment shown in FIG. 8, forward diffusion is performed on the forward diffusion module based on the exponential power distribution based on the pre-acquired original electroencephalogram data to obtain noise data. For details, please refer to Figure 1 In step S103 of the embodiment shown in FIG. 8, no further description is given here.
[0187] In step S204 of the embodiment shown in FIG. 8, the reverse denoising module based on the exponential power distribution is trained based on the noise data obtained by forward diffusion, and a trained exponential power diffusion model is obtained. For details, please refer to Figure 1 In step S104 of the embodiment shown in FIG. 8, no further description is given here.
[0188] In step S205 of the embodiment shown in FIG. 8, noise data obeying the exponential power distribution is generated by sampling the probability density function of the pre-set exponential power distribution, and the noise data obeying the exponential power distribution is input into the reverse denoising module of the exponential power diffusion model to gradually reconstruct new electroencephalogram data. For details, please refer to Figure 1 In step S105 of the embodiment shown in FIG. 8, no further description is given here.
[0189] The epilepsy electroencephalogram data expansion method based on the exponential power diffusion model provided in this embodiment uses the maximum likelihood estimation method and the quasi-Newton optimization algorithm to adaptively estimate the optimal shape parameter In the exponential power diffusion model, one of the factors affecting the performance of the model is the selection of the shape parameter , which is one of the core parameters of the exponential power distribution and directly determines the shape characteristics of the distribution. By using the adaptive parameter method, the tedious process and resource waste caused by manual parameter adjustment are avoided, and the model performance is effectively improved. By introducing the exponential power distribution into the traditional diffusion model, the core formulas of the forward diffusion and reverse denoising of the diffusion model are reconstructed. When facing complex data, the diffusion model based on simple Gaussian distribution often cannot accurately capture the true distribution characteristics of the data. This is because the distribution of many actual data does not completely conform to the Gaussian distribution, but may exhibit super-Gaussian (sharp peak and thick tail) or sub-Gaussian (flat and thin tail) characteristics. Therefore, based on the classical diffusion model, the present application introduces a more flexible exponential power distribution, so that the model has the ability to describe super-Gaussian distribution and sub-Gaussian distribution, enhances the learning and modeling ability of the diffusion model, and better completes the data expansion task.
[0190] In this embodiment, an epilepsy electroencephalogram data expansion method based on an exponential power diffusion model is provided, which can be used in the computer device, Figure 3is a flowchart of an epilepsy electroencephalogram data augmentation method based on an exponential power diffusion model according to an embodiment of the present application, as shown in Figure 3 , the flow includes the following steps:
[0191] Step S301, set the optimal shape parameter of the exponential power distribution. For details, see step S201 of the embodiment shown in Figure 2 , which will not be repeated here.
[0192] Step S302, based on the optimal shape parameter, construct the forward diffusion module based on the exponential power distribution and the backward denoising module based on the exponential power distribution. For details, see step S202 of the embodiment shown in Figure 2 , which will not be repeated here.
[0193] Step S303, based on the pre-acquired original electroencephalogram data, perform forward diffusion on the forward diffusion module based on the exponential power distribution to obtain noise data.
[0194] Specifically, a training module of the exponential power diffusion model is constructed: a training submodule of the forward diffusion module is constructed, and the input data of the exponential power diffusion model is randomly subjected to a forward diffusion process of steps to obtain noise data .
[0195] First, select the input data from the data set, and after the input step of constructing the exponential power diffusion model, select the data type that needs to be augmented according to the period of the electroencephalogram activity in the segment, i.e., the interictal period, the preictal period, the ictal period and the postictal period, load the preprocessed data of this category, and perform data processing before inputting the model: (1) use the Min-Max method to normalize the data; (2) pad or truncate the data in the channel dimension to ensure the consistency of the data size. Obtain the input data of the exponential power diffusion model , where is the batch size, is the segment length, is the number of channels, is the feature dimension (determined by the sampling frequency).
[0196] The input data after the input step of constructing the exponential power diffusion model is randomly subjected to a forward diffusion process of steps to obtain noise data .
[0197] Step S304, based on the noise data of the forward diffusion, train the backward denoising module based on the exponential power distribution to obtain the trained exponential power diffusion model.
[0198] Specifically, a noise prediction module is constructed: the time step and the noise data Input the U-Net network to obtain the predicted noise ; finally, the mean square error between the exponential power noise added to the data at the first time step and the noise predicted by the reverse denoising module is calculated as the loss value to train the U-Net network.
[0199] Construct the sampling module: first sample a noise from the exponential power distribution ; then, iteratively reconstruct the noise data , at each iteration, input the current time step and noise data into the trained U-Net network to obtain the predicted noise of the current time step , calculate the corresponding mean , variance , and then reconstruct ; finally, after denoising iterations, generate new noise data .
[0200] Step S305, sample the probability density function of the preset exponential power distribution to generate noise data following the exponential power distribution, and input the noise data following the exponential power distribution into the reverse denoising module of the exponential power diffusion model to gradually reconstruct new electroencephalogram data.
[0201] Specifically, in the process of expanding the epileptic electroencephalogram data, first load the trained U-Net network of the exponential power diffusion model, including the noise prediction module and the sampling module, and set the exponential power diffusion model to the evaluation mode. By randomly sampling the probability density function of the exponential power distribution, a large amount of initial noise data is generated; then input these noise data into the trained exponential power diffusion model, and use the sampling module in the reverse denoising module to gradually denoise and reconstruct, finally generate a large amount of electroencephalogram data with similar time-frequency characteristics as the real epileptic electroencephalogram signal. This process adjusts the diffusion step length and the adaptive shape parameter method to ensure the high quality and diversity of the generated data, thereby effectively expanding the clinically scarce electroencephalogram data set during the seizure period and the pre-seizure period, and providing sufficient data support for the subsequent training of the epilepsy prediction model.
[0202] The epilepsy electroencephalogram data expansion method based on the exponential power diffusion model provided by the embodiment can customize the exponential power distribution through the optimal shape parameter, so that the reverse denoising process is more in line with the actual distribution characteristics of the epilepsy electroencephalogram data, and the noise can be more accurately identified and removed, and the characteristics of the real electroencephalogram signal are retained. The encoder and decoder architecture formed by the multi-layer convolution and down-sampling-up-sampling structure can capture the electroencephalogram signal features of different scales, from the microscopic waveform details to the macroscopic time sequence mode, and can effectively process. The residual connection, attention mechanism and time embedding layer enhance the feature extraction capability of the U-Net network, the reverse process of the preset step corresponds to the time step of the forward diffusion, forming a clear denoising path, ensuring that the process of gradually recovering the original signal from the noise data is controllable and stable. The exponential power distribution removes the noise according to the exponential power distribution in each time step, and forms a theoretical closed loop with the forward diffusion process, ensuring the mathematical consistency and physical meaning of the denoising process. The noise data generated by the forward diffusion is directly used as the input of the reverse denoising, and the two modules are constructed based on the same exponential power distribution framework, which seamlessly connects and reduces the data conversion error. The exponential power distribution can better describe the spike thick-tailed characteristics of the electroencephalogram signal, especially the abnormal discharge mode during the epilepsy seizure period, and has more advantages than the traditional Gaussian distribution.
[0203] As one or more specific application embodiments of the present application, Figure 8 and Figure 9 The epilepsy electroencephalogram data expansion method based on the exponential power diffusion model provided by the present application is further described in detail as follows:
[0204] The training batch size in the embodiment is set to 64, the Adam optimizer is used (learning rate 2e-4, β1=0.9, β2=0.999), a total of 1000 epochs are trained, the diffusion process timestep is set to 2000, the input data shape is (30, 16, 256), and the diffusion process uses a linear scheduling strategy. The present application is to solve the problems of small scale, low quality and class imbalance of existing epilepsy electroencephalogram data sets. The present application includes three modules: an exponential power distribution based forward diffusion module, an exponential power distribution based reverse denoising module, and an exponential power diffusion model training and sampling module. The exponential power distribution based forward diffusion module can diffuse the electroencephalogram data into exponential power noise, the exponential power distribution based reverse denoising module can reconstruct the original electroencephalogram data from the exponential power noise, and the exponential power diffusion model training and sampling module can reconstruct new high-quality electroencephalogram data from random noise. In two experiments of the present application, a public electroencephalogram data set CHB-MIT and a public natural image data set CIFAR-10 are used to qualitatively and quantitatively verify the performance of the present application. In the data set CHB-MIT, the typical characteristics of the seizure period, such as sharp waves and spiky waves, can be clearly captured from the seizure signals generated by the exponential power diffusion model (as shown in FIG. 8), and normal electroencephalogram activity patterns, such as alpha waves and beta waves, can be observed from the non-seizure signals generated by the exponential power diffusion model (as shown in FIG. 9). In the CIFAR-10 data set, the exponential power diffusion model achieves an FID (Fréchet Inception Distance) index of 3.1889 and an IS (Inception Score) index of 9.0846 ± 0.0761 in the data generation task, both of which are better than the classic diffusion model. The results show that the exponential power diffusion model is superior to the classic diffusion model in terms of data generation quality and data generation diversity. Figure 8 is 30s seizure data generated by the exponential power diffusion model trained based on the CHBMIT data set, Figure 9 is 30s non-seizure data generated by the exponential power diffusion model trained based on the CHBMIT data set.
[0205] The epilepsy electroencephalogram data expansion method based on the exponential power diffusion model has unique advantages in capturing complex electroencephalogram signal characteristics and learning data distribution. The epilepsy electroencephalogram data expansion method can effectively generate large-scale, high-quality and diversified epilepsy electroencephalogram data, break through the data bottleneck in the epilepsy prediction field, and effectively improve the performance of the epilepsy prediction method. This technical breakthrough effectively solves the long-standing data scarcity problem in the epilepsy prediction field, significantly expands the data scale available for model training, and more importantly, by providing rich and high-quality training samples, the generalization ability and diagnostic accuracy of the epilepsy prediction model can be significantly improved. This makes the epilepsy electroencephalogram data expansion method have higher practical value and clinical application potential.
[0206] In the embodiment, an epilepsy electroencephalogram data expansion device based on an exponential power diffusion model is also provided. The device is used to implement the above embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and contemplated.
[0207] The epilepsy electroencephalogram data expansion device based on the exponential power diffusion model provided in the embodiment includes: Figure 10
[0208] The optimal shape parameter setting module 1001 is configured to set an optimal shape parameter of the exponential power distribution.
[0209] The exponential power diffusion model construction module 1002 is configured to construct a forward diffusion module based on the exponential power distribution and a reverse denoising module based on the exponential power distribution based on the optimal shape parameter.
[0210] The forward diffusion module 1003 is configured to perform forward diffusion on the forward diffusion module based on the exponential power distribution based on the pre-acquired original electroencephalogram data to obtain noise data.
[0211] The reverse denoising module 1004 is configured to train the reverse denoising module based on the exponential power distribution based on the forward diffusion noise data to obtain a trained exponential power diffusion model.
[0212] The reconstruction expansion module 1005 is configured to sample the probability density function of the preset exponential power distribution to generate noise data subject to a Gaussian distribution, and input the noise data subject to the Gaussian distribution into the reverse denoising module of the exponential power diffusion model to gradually reconstruct new electroencephalogram data.
[0213] In some optional embodiments, the optimal shape parameter setting module 1001 includes:
[0214] An adaptive estimation unit is configured to adaptively estimate the optimal shape parameter of the input data based on a maximum likelihood estimation method and a quasi-Newton optimization algorithm.
[0215] In some optional embodiments, the adaptive estimation unit comprises:
[0216] A probability density function setting subunit is configured to set the probability density function of the exponential power distribution.
[0217] A log-likelihood function calculation subunit is configured to calculate the maximum likelihood function based on the probability density function and the pre-acquired raw electroencephalogram data using the maximum likelihood estimation method, and to calculate the log-likelihood function corresponding to the maximum likelihood function.
[0218] An optimal shape parameter calculation subunit is configured to equivalently convert the log-likelihood function into an unconstrained optimization problem, to solve the unconstrained optimization problem using the quasi-Newton optimization algorithm, and to obtain the optimal shape parameter of the input data.
[0219] In some optional embodiments, the exponential power diffusion model construction module 1002 comprises:
[0220] A time step setting unit is configured to specify the Markov chain of the forward process, to set the time step of the forward diffusion, and to construct the input data sample based on the pre-acquired raw electroencephalogram data.
[0221] A sample sequence generation unit is configured to generate a constant sequence for controlling the mean and variance of the exponential power distribution within the time step based on the Markov chain using a scheduling strategy, and to correspond to the time step.
[0222] A forward diffusion module construction unit is configured to construct a forward diffusion process with a preset number of steps, to gradually add the exponential power noise controlled by the constant sequence to the input data sample in each step based on the optimal shape parameter, to convert the input data sample into a sample sequence subject to the exponential power distribution after the above-mentioned time step, and to obtain the forward diffusion module based on the exponential power distribution.
[0223] In some optional embodiments, the forward diffusion module construction unit comprises:
[0224] A reparameterization introduction and reconstruction subunit is configured to introduce the sample sequence obtained by gradually adding the exponential power noise in the forward diffusion process into the reparameterization technique, and to reconstruct the sample sequence subject to the exponential power distribution into a form conforming to the gamma distribution and the uniform distribution.
[0225] A first derivation subunit is configured to convert the exponential power distribution into a re-expression form of the noise sampled from the uniform distribution after linear scaling and translation.
[0226] A second derivation subunit is configured to calculate the mean and variance of the specified subitem in the re-expression form, and calculate a relationship from the start time to an arbitrary time in the forward diffusion process based on the Lyapunov Central Limit Theorem, and take the relationship as the forward diffusion module based on the exponential power distribution.
[0227] In some optional embodiments, the exponential power diffusion model construction module 1002 further comprises:
[0228] A forward diffusion unit is configured to input the pre-acquired original electroencephalogram data into the forward diffusion module based on the exponential power distribution to obtain noise data.
[0229] A U-Net network construction unit is configured to construct a U-Net network for encoding time step information based on the forward diffusion module based on the exponential power distribution, input the noise data into the U-Net network, learn the distribution pattern of the noise data through a multi-layer convolution and down-sampling and up-sampling structure, add a residual connection and an attention mechanism to the U-Net network, and integrate the time step information into each layer of the U-Net network through a time embedding layer to obtain the output of the U-Net network.
[0230] A reverse denoising module construction unit is configured to construct a reverse denoising process with a preset number of steps based on the output of the U-Net network, and continuously remove noise from random noise according to the exponential power distribution at each time step based on the best shape parameter to obtain the reverse denoising module based on the exponential power distribution.
[0231] In some optional embodiments, the reverse denoising module construction unit comprises:
[0232] A third derivation subunit is configured to construct a learning model to learn the first conditional probability of the exponential power distribution, and calculate the second conditional probability based on the first conditional probability and the sampled data point at the start time using the Bayes formula.
[0233] A fourth derivation subunit is configured to obtain a preset number of exponential power distributions obtained in the forward diffusion, and substitute the preset number of exponential power distributions into the Bayes formula to obtain a transformed form of the second conditional probability.
[0234] A fifth derivation subunit is configured to derive an analytical expression of the corresponding mean and variance based on the standard exponential power distribution based on the transformed form of the second conditional probability, and obtain an expression of the sampled data point at the start time based on the derivation process of the forward diffusion process.
[0235] A reverse denoising module construction subunit is configured to substitute the expression of the sampled data point at the start time into the analytical expression of the mean and variance to obtain the reverse denoising module based on the exponential power distribution.
[0236] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0237] In this embodiment, the epilepsy EEG data augmentation device based on the exponential diffusion model is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0238] This invention also provides a computer device having the above-described features. Figure 10 The device shown is an epilepsy EEG data augmentation device based on an exponential power diffusion model.
[0239] Please see Figure 11 , Figure 11 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 11 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 11 Take a processor 10 as an example.
[0240] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.
[0241] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.
[0242] The memory 20 can include a program storage area and a data storage area, where the program storage area can store an operating system, application programs required by at least one function, and the data storage area can store data created according to the use of the computer device, etc. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some optional embodiments, the memory 20 can optionally include a memory disposed remotely with respect to the processor 10, which can be connected to the computer device through a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0243] The memory 20 can include a volatile memory, such as a random access memory; the memory can also include a non-volatile memory, such as a flash memory, a hard disk, or a solid-state disk; and the memory 20 can also include a combination of the above-mentioned kinds of memories.
[0244] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30, and the output device 40 can be connected through a bus or other means, Figure 11 For example, by way of example, through a bus connection.
[0245] The input device 30 can receive inputted digital or character information, and generate key signal inputs related to the user settings and function controls of the computer device, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, a pointing stick, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 can include a display device, an auxiliary lighting device (e.g., an LED), a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes, but is not limited to, a liquid crystal display, a light-emitting diode, a display, and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0246] The embodiments of the present application further provide a computer readable storage medium, and the method according to the embodiments of the present application can be implemented in hardware, firmware, or recorded in a storage medium, or stored in a remote storage medium or a non-transitory machine readable storage medium and downloaded to a local storage medium through network, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor, or programmable or special hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid state disk, etc. Further, the storage medium can also include a combination of the above-mentioned memories. It can be understood that the computer, the processor, the microprocessor controller, or the programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiments is implemented.
[0247] Part of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, the operation of the computer can invoke or provide the method and / or technical solutions according to the present application. Those skilled in the art should understand that the form of computer program instructions in computer readable medium includes but is not limited to source file, executable file, installation package file, etc. Correspondingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.
[0248] Although the embodiments of the present application are described in conjunction with the accompanying drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.
Claims
1. An epilepsy electroencephalogram data augmentation method based on an exponential power diffusion model, characterized in that, The method comprises: setting an optimal shape parameter of an exponential power distribution; the setting of the optimal shape parameter of the exponential power distribution comprises: adaptively estimating the optimal shape parameter of the input data based on a maximum likelihood estimation method and a quasi-Newton optimization algorithm; the adaptive estimation of the optimal shape parameter of the input data based on the maximum likelihood estimation method and the quasi-Newton optimization algorithm comprises: setting a probability density function of the exponential power distribution; the probability density function of the exponential power distribution is: ; wherein is the gamma function, is the central moment parameter, is the mean parameter, is the shape parameter, denotes a random variable, here only the probability density function of an exponentially power distribution is defined first; based on the probability density function and the pre-acquired original electroencephalogram data, using a maximum likelihood estimation algorithm to calculate a maximum likelihood function, and calculating a log-likelihood function corresponding to the maximum likelihood function; the log-likelihood function is: ; wherein, is sample data in the training data set; is the number of sample data. equivalent to an unconstrained optimization problem, using a quasi-Newton optimization algorithm to solve the unconstrained optimization problem, and obtaining the optimal shape parameter of the input data; the optimal shape parameter is expressed as: ; based on the optimal shape parameter, constructing a forward diffusion module based on the exponential power distribution and a reverse denoising module based on the exponential power distribution; based on the pre-acquired original electroencephalogram data, performing forward diffusion on the forward diffusion module based on the exponential power distribution to obtain noise data; based on the forward diffusion noise data, training the reverse denoising module based on the exponential power distribution to obtain a trained exponential power diffusion model; sampling the preset probability density function of the exponential power distribution to generate noise data subject to the exponential power distribution, and inputting the noise data subject to the exponential power distribution into the reverse denoising module of the exponential power diffusion model to gradually reconstruct new electroencephalogram data.
2. The method of claim 1, wherein, based on the optimal shape parameter, constructing a forward diffusion module based on the exponential power distribution, comprises: specifying a Markov chain of a forward process, setting a time step of forward diffusion, and constructing input data samples based on pre-acquired original electroencephalogram data; based on the Markov chain, using a scheduling strategy to generate a constant sequence for controlling the mean and variance of the exponential power distribution corresponding to the time step within the time step; constructing a forward diffusion process with a preset number of steps, and gradually adding exponential power noise controlled by the constant sequence to the input data samples in each step based on the optimal shape parameter, so that the input data samples are converted into a sample sequence subject to the exponential power distribution after the above time step, and a forward diffusion module based on the exponential power distribution is obtained.
3. The method of claim 2, wherein, the construction of the forward diffusion process with a preset number of steps, the gradual addition of the exponential power noise controlled by the constant sequence to the input data samples in each step based on the optimal shape parameter, the conversion of the input data samples into a sample sequence subject to the exponential power distribution after the above time step, and the obtaining of a forward diffusion module based on the exponential power distribution, comprises: introducing the sample sequence obtained by gradually adding the exponential power noise in the forward diffusion process into the reparameterization technology, and reconstructing the sample sequence subject to the exponential power distribution obtained after the forward diffusion into a form conforming to the gamma distribution and the uniform distribution; the exponential power distribution is converted into noise sampled from the uniform distribution, and is represented in a new form after linear scaling and translation; The mean and variance of the specified sub-item in the re-expression form are calculated, and a relationship from the start time to any time in the forward diffusion process is calculated based on a Lyapunov central limit theorem, and the relationship is taken as an exponential power distribution-based forward diffusion module.
4. The method of claim 1, wherein, An exponential power distribution-based reverse denoising module is constructed based on the optimal shape parameter, including: The pre-acquired original electroencephalogram data is input into the exponential power distribution-based forward diffusion module for forward diffusion to obtain noise data; The U-Net network for encoding time step information is constructed based on the exponential power distribution-based forward diffusion module, the noise data is input into the U-Net network, the distribution pattern of the noise data is learned through a multi-layer convolution and a down-sampling, up-sampling structure, and a residual connection and an attention mechanism U-Net network are added to the U-Net network, and the time step information is integrated into each layer network of the U-Net network through a time embedding layer to obtain the output of the U-Net network; The reverse denoising process with a preset number of steps is constructed based on the output of the U-Net network, and the noise is continuously removed from the random noise according to the exponential power distribution at each time step based on the optimal shape parameter to obtain the exponential power distribution-based reverse denoising module.
5. The method of claim 4, wherein, The reverse denoising process with a preset number of steps is constructed based on the output of the U-Net network, and the noise is continuously removed from the random noise according to the exponential power distribution at each time step based on the optimal shape parameter to obtain the exponential power distribution-based reverse denoising module, including: A learning model is constructed to learn the first conditional probability of the exponential power distribution, and the second conditional probability is calculated based on the first conditional probability and the starting time sampling data point using the Bayes formula; A preset number of exponential power distributions obtained in the forward diffusion are obtained, and the preset number of exponential power distributions are substituted into the Bayes formula to obtain a transformed form of the second conditional probability; Based on the transformed form of the second conditional probability and the standard exponential power distribution, an analytical expression of the corresponding mean and variance is derived, and an expression of the starting time sampling data point is derived based on the derivation process of the forward diffusion process; The expression of the starting time sampling data point is substituted into the analytical expression of the mean and variance to obtain the exponential power distribution-based reverse denoising module.
6. An epilepsy electroencephalogram data augmentation device based on an exponential power diffusion model, characterized in that, The device includes: An optimal shape parameter setting module is configured to set an optimal shape parameter of an exponential power distribution; the setting of the optimal shape parameter of the exponential power distribution includes: The optimal shape parameter of the input data is adaptively estimated based on the maximum likelihood estimation method and the quasi-Newton optimization algorithm; The optimal shape parameter of the input data is adaptively estimated based on the maximum likelihood estimation method and the quasi-Newton optimization algorithm, including: A probability density function of the exponential power distribution is set; the probability density function of the exponential power distribution is: ; wherein is a gamma function, is a central moment parameter, is a mean parameter, is a shape parameter, denotes a random variable, here only the probability density function of an exponentially power distribution is defined first; Based on the probability density function and the pre-acquired original electroencephalogram data, a maximum likelihood function is calculated using the maximum likelihood estimation method, and a log-likelihood function corresponding to the maximum likelihood function is calculated; the log-likelihood function is: ; wherein, is the sample data in the training data set; is the number of sample data. The log-likelihood function is equivalent to an unconstrained optimization problem, and a quasi-Newton optimization algorithm is used to solve the unconstrained optimization problem to obtain the optimal shape parameter of the input data; the optimal shape parameter is represented as: ; An exponential power diffusion model construction module is configured to construct an exponential power distribution-based forward diffusion module and an exponential power distribution-based reverse denoising module based on the optimal shape parameter; A forward diffusion module is configured to perform forward diffusion on the exponential power distribution-based forward diffusion module based on pre-acquired original electroencephalogram data to obtain noise data; A reverse denoising module is configured to train the exponential power distribution-based reverse denoising module based on the noise data of the forward diffusion process to obtain a trained exponential power diffusion model; A reconstruction expansion module is configured to sample a preset probability density function of exponential power distribution to obtain noise data subject to exponential power distribution, and input the noise data subject to exponential power distribution into the reverse denoising module of the exponential power diffusion model to gradually reconstruct new electroencephalogram data.
7. A computer device, comprising: Comprise: A memory and a processor, which are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the epilepsy electroencephalogram data expansion method based on the exponential power diffusion model according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are used to make the computer execute the epilepsy electroencephalogram data expansion method based on the exponential power diffusion model according to any one of claims 1 to 5.
Citation Information
Patent Citations
Unsupervised epilepsy detection system based on de-noising diffusion probability model
CN117338314A