# 4-Class MI-EEG Signal Generation and Recognition with CVAE-GAN
## 1 Introduction  
Electroencephalogram (EEG) records the electric potential variations from pyramidal neurons in the cortical layers, therefore recognized as the reflection of the brain activity, and can be used to study mind processes [1, 2, 3]. Although EEG has shown to be a critical tool in many domains, it still suffers from a few limitations that hinder its effective analysis or processing. Owing to the brain activity buried under multiple environmental sources, EEG maintains a quite low signal-to-noise ratio (SNR) [4, 5]. Consequently, various filtering and noise reduction techniques including the deep learning (DL) [6] method have been used to minimize the impact of these noise sources and extract true brain activity from the recorded signals. Meanwhile, the DL framework has shown outstanding performance in the field of complex data processing such as text audio signals and images [7], playing an ever-increasing role in industrial applications. By virtue of the sufficient training data, DL can study computational models and learn hierarchical representations of input data through successive non-linear transformations [8, 9], indicating the size of the available training data as the restriction of the performance about the identifying model in brain computer interface (BCI) [10, 11]. The EEG-based BCI decoding process involves pre-processing, feature extracting, and pattern recognition (classification or regression) [12]. The goal of pre-processing and feature extracting is to extract the target band and channel information from raw EEG and represent it in a compact and relevant manner which is conductive to classification. Regression and classification map the extracted feature vector for probability value or n-categories classification results. Figure 1 shows the general paradigm of a BCI system, receiving brain signals and mapping them into control commands for robotic equipment. The system includes several key components, including decoding and control part. The brain signals are collected from humans and sent to the preprocessing component for denoising and enhancement. Then, the discriminating features can be extracted from the processed signals and sent to the classifier, recognizing and converting the signals into external device commands. Generative Adversarial Networks (GAN) allows synthesis of data from latent representations of samples [13], while relying heavily on optimizing generative models, however, suffering from training instability [14]. In this work, we employed the GAN combined with a conditional variational auto-encoder (CVAE) [15] to synthesize EEG signals. By varying the motor imagery category label fed into the resulting generative model, we could generate EEG in a specific category with random noise on a latent attribute vector. We adopted an encoder network to learn the temporal and spectral representations of real EEG samples by simultaneously training a GAN to enforce the learning of the representations. Due to this, our proposed approach had achieved two main contributions. First, this distribution learning of latent representations could help us to generate high imitation of real EEG based on its task features used for data increase and augmentation. Second, benefited from the adversarial learning network, the proposed model also could perform well in motor imagery (MI) task classification through the temporal-spectrum image transformed form the raw EEG. We experimented with public and private MI-EEG data, demonstrating its robust capability of generating realistic and diverse samples with motor imagery labels. Finally, we compared the diverse discussions based on methodological choices of the models with evaluation metrics, thus revealing the optimal results obtained from this study. Our approach had two novel aspects. First, we adopted CVAE as the generative model for feature sub-space and synthetic EEG reconstruction by virtue of class information of MI-EEG samples.