A Model Compression Method for Electroencephalogram Deep Neural Networks

By selecting the target electrode channel in the brain-computer interface system and using the product quantization method of binary tree and K-mean clustering to perform approximate calculation of the full connection layer, the problem of high resource consumption of brain-computer interface system in the prior art is solved, and lower computing complexity and better equipment deployment are achieved.

CN114580629BActive Publication Date: 2025-05-27XIDIAN UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210061482.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-19
Publication Date
2025-05-27
Estimated Expiration
2042-01-19

AI Technical Summary

Technical Problem

The existing brain-computer interface system consumes a lot of resources during deployment, especially due to the complexity and transient nature of the EEG signal, which makes it difficult to deploy models on wearable and embedded devices.

Method used

By using the EEG signal data of multi-electrode channels to train the neural network model, select the target electrode channel, and perform approximation calculation of the fully connected layer based on the product quantization method of binary tree and K-mean clustering, reducing the calculation complexity.

Benefits of technology

It greatly reduces the computing complexity of EEGNet, simplifies the deployment of models on wearable and embedded devices, and supports better brain-computer interface application research.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114580629B_ABST
    Figure CN114580629B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for compressing the model of an electroencephalogram deep neural network, which uses the weights of the depthwise convolutional layer to complete the selection of target electrode channels, so as to avoid large-scale artificial design feature calculations or the design of dedicated channel selectors, and make full use of the characteristics of the electroencephalogram deep neural network EEGNet itself. At the same time, for the fully connected layer, the present invention uses a binary tree to complete the centroid category to which the input vector belongs, greatly simplifying the calculation process of the fully connected layer. Furthermore, in a manner combining target channel selection and product quantization of the fully connected layer, the compression of the electroencephalogram deep neural network model is completed. The method for compressing the model of the electroencephalogram deep neural network provided by the present invention can greatly reduce the computational complexity of EEGNet, reduce the deployment difficulty of the model on wearable, embedded and other devices, and thus better support the relevant research on brain-computer interface applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a model compression method for an electroencephalogram (EEG) deep neural network. Background Art

[0002] As the control center of the human body, decryption of brain activity is considered to be one of the most challenging scientific problems at present. By interpreting EEG (Electroencephalogram) signals, the brain-computer interface system can enable the brain to communicate directly with the machine and realize the brain's control over the machine. Therefore, it has been widely studied in recent years. Existing brain-computer interface systems usually need to calculate artificially designed EEG signal features. However, EEG signals are highly complex and instantaneous, and artificial features are complex and error-prone, which has certain limitations. Brain-computer interface systems based on deep neural network self-learning can avoid this problem to a certain extent. However, due to the wide range of application scenarios and deployment paradigms of brain-computer interfaces, specific neural network structures still need to be designed for each application.

[0003] In the 2018 paper "EEGNet: A Compact Convolutional Network for EEG-based Brain-Computer Interfaces" published in the Journal of Neural Engineering, researchers proposed a universal compact EEG deep neural network model EEGNet, which reduces network parameters while improving the versatility of deep neural network models in different brain-computer interface applications. It has also been verified to have high performance in various brain-computer interface deployment paradigms such as event-related potential classification and motor imagery signal recognition.

[0004] However, this method requires the use of EEG signals from more channels to complete accurate classification, and the final fully connected classification layer still requires a large number of multiplication and addition calculations, resulting in the overall model still being relatively resource-intensive when deployed. Summary of the invention

[0005] In order to solve the above problems existing in the prior art, the present invention provides a model compression method for an EEG deep neural network. The technical problem to be solved by the present invention is achieved by the following technical solutions:

[0006] The present invention provides a model compression method for an EEG deep neural network, comprising:

[0007] Using the EEG signal data of multiple electrode channels to train the neural network to be trained, to obtain a first neural network model;

[0008] According to the first neural network model, selecting at least one target electrode channel;

[0009] Using the EEG signal data of the target electrode channel to train the neural network model to be trained, to obtain a second neural network model;

[0010] When the difference between the classification accuracy of the second neural network model and the classification accuracy of the first neural network model is less than or equal to a first preset value, generating an input vector of a fully connected layer in the second neural network model using a preset training data set;

[0011] After dividing each input vector into multiple sub-vectors, a lookup table is established according to the sub-vectors and the second neural network model, and a binary tree corresponding to each sub-vector is generated;

[0012] After determining the first classification accuracy of the fully connected layer in the first neural network model using a preset test data set, for each test input, determining the output result of the fully connected layer in the second neural network model based on the binary tree and the lookup table, and determining the second classification accuracy of the fully connected layer in the second neural network model;

[0013] When the difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value, the second neural network model is determined as a compressed neural network model.

[0014] In one embodiment of the present invention, the step of selecting at least one target electrode channel according to the first neural network model includes:

[0015] Calculating the scores of the weights of each electrode channel corresponding to the depthwise convolutional layer in the first neural network model, and sorting the scores from high to low;

[0016] A preset number of electrode channels with the highest scores are selected as target electrode channels.

[0017] In one embodiment of the present invention, when the difference between the classification accuracy of the second neural network model and the classification accuracy of the first neural network model is less than or equal to a first preset value, before the step of using a preset training data set to generate an input vector of a fully connected layer in the second neural network model, the step further includes:

[0018] Detecting whether the difference between the classification accuracy of the second neural network model and the classification accuracy of the first neural network model is less than or equal to a first preset value;

[0019] If not, returning to the step of selecting the preset number of electrode channels with the highest scores as target electrode channels;

[0020] If so, execute the step of using the preset training data set to generate the input vector of the fully connected layer in the second neural network model.

[0021] In one embodiment of the present invention, after dividing each input vector into multiple sub-vectors, establishing a lookup table according to the sub-vectors and the second neural network model, and generating a binary tree corresponding to each sub-vector includes:

[0022] Divide each input vector into N sub-vectors;

[0023] Clustering each of the sub-vectors to generate N×K centroids;

[0024] Calculate the product of the centroid and the fully connected layer weight corresponding to it in the second neural network model, and store the product in a lookup table;

[0025] For each sub-vector, a binary tree containing K sub-leaves is generated.

[0026] In one embodiment of the present invention, after determining the first classification accuracy of the fully connected layer in the first neural network model using a preset test data set, for each test input, determining the output result of the fully connected layer in the second neural network model based on the binary tree and the lookup table, and determining the second classification accuracy of the fully connected layer in the second neural network model, the step includes:

[0027] Get the preset test data set;

[0028] Inputting each test input into a fully connected layer in the first neural network model, and determining a first classification accuracy of the fully connected layer in the first neural network model based on an output result;

[0029] For each of the test inputs, N intermediate results are obtained according to the binary tree and the lookup table query, and after accumulating the N intermediate results, the second classification accuracy of the fully connected layer in the second neural network model is determined according to the accumulated results.

[0030] In one embodiment of the present invention, when the difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value, before the step of determining the second neural network model as a compressed neural network model, the step further includes:

[0031] Detecting whether a difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value;

[0032] If not, after updating the values ​​of N and K, the step of dividing each input vector into N sub-vectors is performed;

[0033] If so, execute the step of determining the second neural network model as a compressed neural network model.

[0034] In one embodiment of the present invention, the neural network to be trained is an EEG deep neural network EEGNet.

[0035] Compared with the prior art, the present invention has the following beneficial effects:

[0036] The model compression method of the EEG deep neural network provided by the present invention utilizes the depth-wise convolutional layer weights of EEGNet to select the target electrode channels of the EEG signal, and completes the approximate calculation of the fully connected layer in the second neural network model based on the product quantization method of binary tree and K-mean clustering, thereby greatly reducing the computational complexity of EEGNet and reducing the difficulty of deploying the model on wearable, embedded and other devices, thereby better supporting related brain-computer interface application research.

[0037] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is a flow chart of a model compression method of an EEG deep neural network provided by an embodiment of the present invention;

[0039] Figure 2 It is a schematic diagram of the structure of the EEG deep neural network EEGNet provided by an embodiment of the present invention;

[0040] Figure 3 It is a schematic diagram of a model compression method of an EEG deep neural network provided by an embodiment of the present invention;

[0041] Figure 4 is another schematic diagram of a model compression method for an EEG deep neural network provided by an embodiment of the present invention;

[0042] Figure 5 This is another flow chart of the model compression method of the EEG deep neural network provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0043] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.

[0044] Figure 1 This is a flow chart of a method for compressing a model of an EEG deep neural network provided by an embodiment of the present invention. Figure 1 , an embodiment of the present invention provides a model compression method of an EEG deep neural network, comprising:

[0045] S1, using the EEG signal data of multiple electrode channels to train the neural network to be trained, to obtain a first neural network model;

[0046] S2. Selecting at least one target electrode channel according to the first neural network model;

[0047] S3, using the EEG signal data of the target electrode channel to train the neural network model to obtain a second neural network model;

[0048] S4. When the difference between the classification accuracy of the second neural network model and the classification accuracy of the first neural network model is less than or equal to a first preset value, using a preset training data set to generate an input vector of a fully connected layer in the second neural network model;

[0049] S5, after dividing each input vector into multiple sub-vectors, establishing a lookup table according to the sub-vectors and the second neural network model, and generating a binary tree corresponding to each sub-vector;

[0050] S6. After determining the first classification accuracy of the fully connected layer in the first neural network model using a preset test data set, for each test input, determine the output result of the fully connected layer in the second neural network model based on the binary tree and the lookup table, and determine the second classification accuracy of the fully connected layer in the second neural network model;

[0051] S7. When the difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value, the second neural network model is determined as a compressed neural network model.

[0052] Figure 2 Schematic diagram of the structure of the EEG deep neural network EEGNet provided by the embodiment of the present invention. Figure 2Taking the structure shown in FIG. 1 as an example, the structure of the EEG deep neural network EEGNet is explained. Specifically, the input of the neural network to be trained is multi-channel EEG signal data with C rows and T columns, where C represents the number of EEG acquisition channels and T represents the number of sampling points of this EEG signal segment; after F1 two-dimensional convolutions (conv2D), multi-channel EEG signal data with C rows and T columns in F1 frequency bands (CChn1~F1) is generated; after D*F1 depthwise convolutions (depthwise conv1) with a size of C rows and 1 column, D*F1 vectors of 1 row and T columns are obtained; then, after passing through the exponential activation unit (ELU), average pooling (AvePool1) with a step size of 4 is performed to obtain D*F1 vectors of 1 row and T / 4 columns; further, after being processed by separable convolution (Separable conv), it is input into the exponential activation unit for processing, and then average pooling (AvePool2) with a step size of 8 is completed to obtain D*F1 vectors of 1 row and T / 32 columns; these vectors are expanded to complete the fully connected layer (Dense Layer) is used for classification layer calculation, and the final M classification result is obtained by the softmax function. For example, the Dropout rate of AvePool1 output and AvePool2 output, the number of iterations and other parameters can be set, and the Adam optimizer embedded in Tensorflow is used to minimize the target cross entropy function to complete network learning.

[0053] It should be understood that in the above process, the two-dimensional convolution has the largest amount of computation and is strongly related to the number of channels C; due to the vector expansion of T / 32 columns, the computational complexity of the multiplication and addition operations of the fully connected layer is also large, so this embodiment compresses and optimizes these two layers to obtain maximum benefits.

[0054] In the above step S2, the step of selecting at least one target electrode channel according to the first neural network model includes:

[0055] S201, calculating the scores of the weights of each electrode channel corresponding to the depthwise convolution layer in the first neural network model, and sorting the scores from high to low;

[0056] S202 , selecting a preset number of electrode channels with the highest scores as target electrode channels.

[0057] Specifically, after training the first neural network model, calculate the scores of the weights corresponding to each electrode channel in its depthwise convolutional layer, and sort them in descending order of scores. Among them, the higher the score of the channel electrode, the higher its contribution degree. Then, select a preset number of electrode channels with the highest contribution degree, that is, the highest scores, as the target electrode channels. Exemplarily, D*F1 depthwise convolutional kernels (C, 1) perform weighted summation on the EEG signal data of C channels, and then extract features of different dimensions. Therefore, the weight of each depthwise convolutional kernel corresponds to an EEG signal acquisition channel, and the magnitude of the weight represents the importance of this channel. Further, calculate the mean of the sum of the absolute values of the F1 weights to obtain the scores of the weights of each electrode channel. After sorting from large to small, select the electrode channels corresponding to the first Cx (Cx < C) weights as the compressed target electrode channels.

[0058] In step S3 above, use the EEG signal data of the selected target electrode channels to train the neural network model to be trained, obtain the second neural network model, and test the classification accuracy of the second neural network model. Figure 3 It is a schematic diagram of a model compression method for an EEG deep neural network provided by an embodiment of the present invention. Further, as Figure 3 shown, use a preset training data set to generate the input vectors of the fully connected layer in the second neural network model. In this embodiment, the dimension of this input vector is

[0059] Figure 4 It is another schematic diagram of a model compression method for an EEG deep neural network provided by an embodiment of the present invention. Please refer to Figure 3 and Figure 4 , in step S5, after dividing each input vector into multiple sub-vectors, the steps of establishing a lookup table according to the sub-vectors and the second neural network model and generating a binary tree corresponding to each sub-vector include:

[0060] S501. Divide each input vector into N sub-vectors on average;

[0061] S502. Cluster each sub-vector to generate N×K centroids;

[0062] S503. Calculate the product of the centroid and the weight of the corresponding fully connected layer in the second neural network model, and store the product in the lookup table;

[0063] S504. For each sub-vector, generate a binary tree with K sub-leaves.

[0064] Please continue to refer to Figure 3 The preset training data set contains X dimensional input vector, for each input vector, divide it into N sub-vectors according to the dimension, and perform K-means clustering on each sub-vector to generate K centroids; that is, for each input vector, a total of N*K centroids are generated; then, the product of the centroid and the corresponding fully connected layer weight in the second neural network model is calculated and stored in the corresponding lookup table of K elements, and the number of lookup tables is N.

[0065] like Figure 4 As shown, in step S504, a binary tree with K sub-leaves is generated for each sub-vector, where the bifurcation threshold of each layer of nodes is j represents the jth layer, i represents the i-th node in the jth layer, i=1,2,……,2 j-1 , the bifurcation threshold should minimize the variance of the set after bifurcation. Obviously, the binary tree has t=log2(k) layers, and the tth layer has K nodes, which represent the centroid corresponding to the input vector and are used to obtain the elements stored in the lookup table later.

[0066] Optionally, in the above step S6, after determining the first classification accuracy of the fully connected layer in the first neural network model using a preset test data set, for each test input, determining the output result of the fully connected layer in the second neural network model based on the binary tree and the lookup table, and determining the second classification accuracy of the fully connected layer in the second neural network model, comprises:

[0067] S601, obtaining a preset test data set;

[0068] S602, inputting each test input into a fully connected layer in the first neural network model, and determining a first classification accuracy of the fully connected layer in the first neural network model according to the output result;

[0069] S603: for each test input, obtain N intermediate results according to the binary tree and the lookup table query, accumulate the N intermediate results, and determine the second classification accuracy of the fully connected layer in the second neural network model according to the accumulated results.

[0070] Specifically, after obtaining the preset test data set, each test input is input into the fully connected layer of the first neural network model to determine the first classification accuracy of the fully connected layer in the first neural network model. In step S603, for each test input, a binary tree and a lookup table are used to obtain N intermediate results IR1~N, and the N intermediate results are accumulated to complete the calculation of the fully connected layer based on product quantization, thereby determining the second classification accuracy of the fully connected layer in the second neural network model.

[0071] If the difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value, the second neural network model is a compressed neural network model.

[0072] It can be seen that the present invention uses the weights of the deep convolutional layer to complete the selection of the target electrode channels for the EEG deep neural network EEGNet with paradigm universality, so as to avoid large-scale artificially designed feature calculations or design of dedicated channel selectors, and make full use of the characteristics of EEGNet itself; at the same time, for the fully connected layer, the present invention uses a binary tree to complete the centroid category to which the input vector belongs, greatly simplifying the calculation process of the fully connected layer, and then completing the compression of the EEG deep neural network model by combining the target channel selection and the fully connected layer product quantization.

[0073] Figure 5 is another flow chart of the EEG deep neural network model compression method provided by an embodiment of the present invention. Optionally, when the difference between the classification accuracy of the second neural network model and the classification accuracy of the first neural network model is less than or equal to a first preset value, before the step of using a preset training data set to generate an input vector of a fully connected layer in the second neural network model, it also includes:

[0074] Detecting whether the difference between the classification accuracy of the second neural network model and the classification accuracy of the first neural network model is less than or equal to a first preset value;

[0075] If not, return to the above step of selecting a preset number of electrode channels with the highest scores as target electrode channels;

[0076] If so, execute the above step of using the preset training data set to generate the input vector of the fully connected layer in the second neural network model.

[0077] It can be understood that in the above step S3, when the second neural network model is obtained by training the EEG signal data of the target electrode channel, the small number of selected EEG signals may lead to the omission of important electrode channels. Therefore, the classification accuracy of the first neural network model is compared with that of the second neural network model. If the difference between the two is less than or equal to 1%, the above step of using the preset training data set to generate the input vector of the fully connected layer in the second neural network model is executed; conversely, if the difference between the two is greater than 1%, it is necessary to increase the number of selected target electrode channels. Exemplarily, the preset number of electrode channels with the highest scores can be determined as the target electrode channels based on the scores of the remaining electrode channels, so as to conduct a new round of learning and testing on the second neural network model.

[0078] Optionally, when the difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value, before the step of determining the second neural network model as the compressed neural network model, the method further includes:

[0079] Detecting whether the difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value;

[0080] If not, after updating the values ​​of N and K, the step of dividing each input vector into N sub-vectors is performed;

[0081] If so, the step of determining the second neural network model as the compressed neural network model is executed.

[0082] In this embodiment, the first classification accuracy is compared with the second classification accuracy. If the difference between the first classification accuracy and the second classification accuracy is less than or equal to 1%, it means that the performance of the fully connected layer in the second neural network model is close to the performance of the fully connected layer accurately calculated in the first neural network model. At this time, the EEG deep neural network model, that is, the first neural network model, is compressed. If the difference between the first classification accuracy and the second classification accuracy is greater than 1%, it is necessary to adjust the parameters N, K and the bifurcation threshold v. j i Afterwards, a new round of fully connected layer calculations is performed on the second neural network model.

[0083] It can be seen that the model compression method of the EEG deep neural network provided by the present invention utilizes the depth-wise convolutional layer weights of EEGNet to select the target electrode channels of the EEG signal, and completes the approximate calculation of the fully connected layer in the second neural network model based on the product quantization method of binary tree and K-mean clustering, thereby greatly reducing the computational complexity of EEGNet and reducing the difficulty of deploying the model on wearable, embedded and other devices, thereby better supporting related brain-computer interface application research.

[0084] Below, the model compression method of the above-mentioned EEG deep neural network is further explained by taking examples.

[0085] Step 1. Use the original sample data set commonly used by the MNE open source software tool to learn the neural network EEGNet to be trained. The sample data set belongs to event-related EEG signals, which records the EEG signals when the subjects are stimulated by left / right auditory stimulation and left / right visual stimulation. The number of EEG signal acquisition channels of this data set is C=60, the number of EEG signal segment sampling points is T=151, and the number of categories is M=4. The F1 parameter of EEGNet is set to 8, and the depthwise convolution expansion dimension D is set to 2. There are 288 EEG signal samples in the data set, 144 of which are selected as the learning set, 72 as the validation set, and the remaining 72 as the test set for EEGNet validation.

[0086] Step 2: Calculate the absolute mean of the weights at the same dimension of the 16 depthwise convolutional layers in the 8 frequency channels and sort them from large to small, and select the electrode channels corresponding to the first 20 dimensions, the first 16 dimensions, the first 8 dimensions, and the first 4 dimensions as the target electrode channels.

[0087] Step 3: According to the selected target electrode channels, the EEGNet neural network to be trained is learned, verified and tested for 20-channel, 16-channel, 8-channel and 4-channel input EEG signals respectively to obtain the classification accuracy of the second neural network model.

[0088] Step 4: Input the training set into the second neural network model for propagation, and record all 144 64-dimensional vectors of the fully connected layer. The 64-dimensional vector set is divided into 4 16-dimensional vector sets, and each 16-dimensional vector set is clustered by 16-means to obtain 4*16=64 centroids; the 4 (output category M=4) 64-dimensional weight vectors of the fully connected layer are divided into 4 16-dimensional vectors respectively; the dot product of the 64 16-dimensional centroids and the 16-dimensional weight vectors at the corresponding positions is calculated respectively, and stored in the corresponding lookup table.

[0089] Step 5, generate a 4-level (log2(16)) binary tree with 16 (N*M=16) 16 (K=16) cotyledons, adjust the bifurcation threshold of each node to minimize the variance of each set after bifurcation; use the binary tree and lookup table to calculate the approximate calculation results of the fully connected layer in the second neural network model on the training set.

[0090] Step 6: Compare the classification accuracy of the approximate calculation of the fully connected layer in the second neural network model with the precise calculation of the fully connected layer in the first neural network model. If the two are close, the EEG deep neural network model is compressed; otherwise, adjust the parameters N, K and the binary tree bifurcation threshold to perform a new round of approximate calculation.

[0091] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0092] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification.

[0093] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in a claim. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0094] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A model compression method for EEG deep neural network, It is characterized in that include: Using the EEG signal data of multiple electrode channels to train the neural network to be trained, to obtain a first neural network model; According to the first neural network model, selecting at least one target electrode channel; Using the EEG signal data of the target electrode channel to train the neural network model to be trained, to obtain a second neural network model; When the difference between the classification accuracy of the second neural network model and the classification accuracy of the first neural network model is less than or equal to a first preset value, generating an input vector of a fully connected layer in the second neural network model using a preset training data set; After dividing each input vector into multiple sub-vectors, a lookup table is established according to the sub-vectors and the second neural network model, and a binary tree corresponding to each sub-vector is generated; After determining the first classification accuracy of the fully connected layer in the first neural network model using a preset test data set, for each test input, determining the output result of the fully connected layer in the second neural network model based on the binary tree and the lookup table, and determining the second classification accuracy of the fully connected layer in the second neural network model; When the difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value, determining the second neural network model as a compressed neural network model; The step of selecting at least one target electrode channel according to the first neural network model comprises: Calculating the scores of the weights of each electrode channel corresponding to the depthwise convolutional layer in the first neural network model, and sorting the scores from high to low; A preset number of electrode channels with the highest scores are selected as target electrode channels.

2. The method for compressing a model of an EEG deep neural network according to claim 1, It is characterized in that When the difference between the classification accuracy of the second neural network model and the classification accuracy of the first neural network model is less than or equal to a first preset value, before the step of using a preset training data set to generate an input vector of a fully connected layer in the second neural network model, the method further includes: Detecting whether the difference between the classification accuracy of the second neural network model and the classification accuracy of the first neural network model is less than or equal to a first preset value; If not, returning to the step of selecting the preset number of electrode channels with the highest scores as target electrode channels; If so, execute the step of using the preset training data set to generate the input vector of the fully connected layer in the second neural network model.

3. The model compression method of the EEG deep neural network according to claim 1, It is characterized in that After dividing each input vector into multiple sub-vectors, establishing a lookup table according to the sub-vectors and the second neural network model, and generating a binary tree corresponding to each sub-vector, the step includes: Divide each input vector into N sub-vectors; Clustering each of the sub-vectors to generate N×K centroids; Calculate the product of the centroid and the fully connected layer weight corresponding to it in the second neural network model, and store the product in a lookup table; For each sub-vector, a binary tree containing K sub-leaves is generated.

4. The method for compressing the model of the EEG deep neural network according to claim 3, It is characterized in that After determining the first classification accuracy of the fully connected layer in the first neural network model by using a preset test data set, the step of determining the output result of the fully connected layer in the second neural network model based on the binary tree and the lookup table for each test input, and determining the second classification accuracy of the fully connected layer in the second neural network model includes: Get the preset test data set; Inputting each test input into a fully connected layer in the first neural network model, and determining a first classification accuracy of the fully connected layer in the first neural network model based on an output result; For each of the test inputs, N intermediate results are obtained according to the binary tree and the lookup table query, and after accumulating the N intermediate results, the second classification accuracy of the fully connected layer in the second neural network model is determined according to the accumulated results.

5. The method for compressing the model of the EEG deep neural network according to claim 4, It is characterized in that Before the step of determining the second neural network model as a compressed neural network model when the difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value, the method further includes: Detecting whether a difference between the first classification accuracy and the second classification accuracy is less than or equal to a second preset value; If not, after updating the values ​​of N and K, the step of dividing each input vector into N sub-vectors is performed; If so, execute the step of determining the second neural network model as a compressed neural network model.

6. The method for compressing a model of an EEG deep neural network according to claim 1, It is characterized in that The neural network to be trained is an electroencephalogram (EEG) deep neural network (EEGNet).

Citation Information

Patent Citations

  • Motor imagery electroencephalogram signal processing method, device, and storage medium

    US20220054071A1