CN116304812A - Circuits, systems and chips for recognizing emotions based on EEG signals - Google Patents
Circuits, systems and chips for recognizing emotions based on EEG signals Download PDFInfo
- Publication number
- CN116304812A CN116304812A CN202310185223.9A CN202310185223A CN116304812A CN 116304812 A CN116304812 A CN 116304812A CN 202310185223 A CN202310185223 A CN 202310185223A CN 116304812 A CN116304812 A CN 116304812A
- Authority
- CN
- China
- Prior art keywords
- module
- data
- circuit
- multiplexer
- processing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- A—HUMAN NECESSITIES
- A61—MEDICAL OR VETERINARY SCIENCE; HYGIENE
- A61B—DIAGNOSIS; SURGERY; IDENTIFICATION
- A61B5/00—Measuring for diagnostic purposes; Identification of persons
- A61B5/16—Devices for psychotechnics; Testing reaction times ; Devices for evaluating the psychological state
- A61B5/165—Evaluating the state of mind, e.g. depression, anxiety
-
- A—HUMAN NECESSITIES
- A61—MEDICAL OR VETERINARY SCIENCE; HYGIENE
- A61B—DIAGNOSIS; SURGERY; IDENTIFICATION
- A61B5/00—Measuring for diagnostic purposes; Identification of persons
- A61B5/24—Detecting, measuring or recording bioelectric or biomagnetic signals of the body or parts thereof
- A61B5/316—Modalities, i.e. specific diagnostic methods
- A61B5/369—Electroencephalography [EEG]
-
- A—HUMAN NECESSITIES
- A61—MEDICAL OR VETERINARY SCIENCE; HYGIENE
- A61B—DIAGNOSIS; SURGERY; IDENTIFICATION
- A61B5/00—Measuring for diagnostic purposes; Identification of persons
- A61B5/72—Signal processing specially adapted for physiological signals or for diagnostic purposes
- A61B5/7235—Details of waveform analysis
- A61B5/7264—Classification of physiological signals or data, e.g. using neural networks, statistical classifiers, expert systems or fuzzy systems
- A61B5/7267—Classification of physiological signals or data, e.g. using neural networks, statistical classifiers, expert systems or fuzzy systems involving training the classification device
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Psychiatry (AREA)
- Public Health (AREA)
- Surgery (AREA)
- Veterinary Medicine (AREA)
- Artificial Intelligence (AREA)
- General Health & Medical Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Molecular Biology (AREA)
- Biophysics (AREA)
- Pathology (AREA)
- Biomedical Technology (AREA)
- Heart & Thoracic Surgery (AREA)
- Medical Informatics (AREA)
- Psychology (AREA)
- Fuzzy Systems (AREA)
- Signal Processing (AREA)
- Evolutionary Computation (AREA)
- Physiology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Mathematical Physics (AREA)
- Child & Adolescent Psychology (AREA)
- Developmental Disabilities (AREA)
- Educational Technology (AREA)
- Hospice & Palliative Care (AREA)
- Social Psychology (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Measurement And Recording Of Electrical Phenomena And Electrical Characteristics Of The Living Body (AREA)
Abstract
Description
技术领域technical field
本发明涉及脑电信号处理的技术领域,更具体地说,涉及一种基于脑电信号识别情绪的电路、系统和芯片。The present invention relates to the technical field of EEG signal processing, more specifically, to a circuit, system and chip for recognizing emotions based on EEG signals.
背景技术Background technique
现有的基于脑电信号的情绪识别神经网络,为了达到更高的准确率,有些网络架构相对简单,但需要较为复杂的特征提取方式;在些使用较为简单的特征,但其网络规模则相对较大。当将以上两种情况的网络部署在硬件电路上时,都会引入较大的硬件开销,增加硬件成本。In order to achieve higher accuracy in the existing emotional recognition neural networks based on EEG signals, some network architectures are relatively simple, but require more complex feature extraction methods; some use simpler features, but their network scale is relatively large. larger. When the networks in the above two cases are deployed on hardware circuits, a relatively large hardware overhead will be introduced and the hardware cost will be increased.
发明内容Contents of the invention
本发明要解决的技术问题在于,提供一种基于脑电信号识别情绪的电路、系统和芯片。The technical problem to be solved by the present invention is to provide a circuit, system and chip for recognizing emotions based on EEG signals.
本发明解决其技术问题所采用的技术方案是:构造一种基于脑电信号识别情绪的电路,包括:特征提取单元以及与所述特征提取单元连接的神经网络处理单元;The technical solution adopted by the present invention to solve the technical problem is: to construct a circuit for recognizing emotions based on EEG signals, including: a feature extraction unit and a neural network processing unit connected to the feature extraction unit;
所述神经网络处理单元包括:依次与所述特征提取单元连接的第一LSTM模块、第一数据处理模块、第二LSTM模块、第二数据处理模块、分类模块以及输出模块;The neural network processing unit includes: a first LSTM module, a first data processing module, a second LSTM module, a second data processing module, a classification module and an output module connected to the feature extraction unit in sequence;
所述特征提取单元对原始脑电信号进行离散小波变换处理后,输出特征数据;After the feature extraction unit performs discrete wavelet transform processing on the original EEG signal, output feature data;
所述第一LSTM模块基于LSTM算法对所述特征数据进行处理后,输出一级处理数据;After the first LSTM module processes the feature data based on the LSTM algorithm, it outputs the first-level processed data;
所述第一数据处理模块对所述一级处理数据进行批归一化和整合处理后,输出二级处理数据;After the first data processing module performs batch normalization and integration processing on the primary processing data, it outputs secondary processing data;
所述第二LSTM模块基于所述LSTM算法对所述二级处理数据进行处理后,输出三级处理数据;After the second LSTM module processes the secondary processing data based on the LSTM algorithm, it outputs tertiary processing data;
所述分类模块对所述三级处理数据进行分类处理后,输出分类数据;After the classification module classifies the three-level processing data, it outputs the classification data;
所述输出模块对所述分类数据进行处理后,输出分类结果。After the output module processes the classification data, it outputs classification results.
在本发明所述的基于脑电信号识别情绪的电路中,所述特征提取单元为离散小波特征提取单元;In the circuit for recognizing emotions based on EEG signals according to the present invention, the feature extraction unit is a discrete wavelet feature extraction unit;
所述离散小波特征提取单元对所述原始脑电信号进行离散小波变换后,获得模糊分量和细节分量,并将从所述细节分量作为所述特征数据;After the discrete wavelet feature extraction unit performs discrete wavelet transform on the original EEG signal, obtains a fuzzy component and a detail component, and uses the detail component as the feature data;
所述模糊分量和所述细节分量为与所述原始脑电信号对应的模糊分量和细节分量。The fuzzy component and the detail component are the fuzzy component and the detail component corresponding to the original EEG signal.
在本发明所述的基于脑电信号识别情绪的电路中,所述第一LSTM模块和第二LSTM模块包括:Tanh激活函数子模块;In the circuit for recognizing emotions based on EEG signals according to the present invention, the first LSTM module and the second LSTM module include: a Tanh activation function submodule;
所述Tanh激活函数子模块包括:依次连接的移位电路、选择电路和加法电路;The Tanh activation function submodule includes: a sequentially connected shift circuit, a selection circuit and an addition circuit;
所述移位电路接入所述特征数据并对所述特征数据进行移位处理;The shift circuit accesses the feature data and performs shift processing on the feature data;
所述选择电路对经过所述移位电路移位处理后的数据进行选择后,输出相应的选择数据;The selection circuit outputs corresponding selection data after selecting the data shifted by the shift circuit;
所述加法电路对所述选择数据进行加法运算处理。The addition circuit performs addition processing on the selected data.
在本发明所述的基于脑电信号识别情绪的电路中,所述选择电路包括:第一多路选择器、第二多路选择器、第三多路选择器、反相器、与门以及或非门;In the circuit for recognizing emotions based on EEG signals according to the present invention, the selection circuit includes: a first multiplexer, a second multiplexer, a third multiplexer, an inverter, an AND gate and NOR gate;
所述第一多路选择器的第一输入端与所述移位电路的第一输出端连接,所述第一多路选择器的第二输入端与所述移位电路的第二输出端连接,所述第一多路选择器的第三输入端与所述与门的输出端连接,所述与门的第一输入端通过所述反相器与所述移位电路的第二输出端连接,所述与门的第二输入端接入输入数据,所述第一多路选择器的地址线接入所述输入数据,所述第一多路选择器的输出端连接所述加法电路;The first input end of the first multiplexer is connected to the first output end of the shift circuit, the second input end of the first multiplexer is connected to the second output end of the shift circuit connected, the third input terminal of the first multiplexer is connected to the output terminal of the AND gate, and the first input terminal of the AND gate is connected to the second output terminal of the shift circuit through the inverter The second input terminal of the AND gate is connected to the input data, the address line of the first multiplexer is connected to the input data, and the output terminal of the first multiplexer is connected to the addition circuit;
所述第二多路选择器的第一输入端与所述移位电路的第三输出端连接,所述第二多路选择器的第二输入端与所述移位电路的第四输出端连接,所述第二多路选择器的第三输入端与所述移位电路的第五输出端连接,所述第二多路选择器的第四输入端与所述移位电路的第六输出端连接,所述第二多路选择器的地址线接入所述输入数据,第二多路选择器的输出端连接所述加法电路;The first input end of the second multiplexer is connected to the third output end of the shift circuit, the second input end of the second multiplexer is connected to the fourth output end of the shift circuit connected, the third input terminal of the second multiplexer is connected to the fifth output terminal of the shift circuit, the fourth input terminal of the second multiplexer is connected to the sixth output terminal of the shift circuit The output terminal is connected, the address line of the second multiplexer is connected to the input data, and the output terminal of the second multiplexer is connected to the adding circuit;
所述第三多路选择器的第四输入端连接所述或非门的输出端,所述或非门的第二输入端接入所述输入数据,所述或非门的第一输入端接入参数数据,所述第三多路选择器的地址线接入所述输入数据,第二多路选择器的输出端连接所述加法电路。The fourth input terminal of the third multiplexer is connected to the output terminal of the NOR gate, the second input terminal of the NOR gate is connected to the input data, and the first input terminal of the NOR gate is The parameter data is connected, the address line of the third multiplexer is connected to the input data, and the output terminal of the second multiplexer is connected to the adding circuit.
在本发明所述的基于脑电信号识别情绪的电路中,所述加法电路包括:压缩器和加法器;In the circuit for recognizing emotions based on EEG signals according to the present invention, the adding circuit includes: a compressor and an adder;
所述压缩器的第一输入端连接所述第一多路选择器的输出端,所述压缩器的第二输入端连接所述第二多路选择器的输出端,所述压缩器的第三输入端连接所述第三多路选择器的输出端,所述压缩器的第一输出端分别连接所述加法器的第一输入端和Tanh激活函数子模块的输出端,所述压缩器的第二输出端连接所述加法器的第二输入端,所述加法器的输出端连接所述Tanh激活函数子模块的输出端。The first input end of the compressor is connected to the output end of the first multiplexer, the second input end of the compressor is connected to the output end of the second multiplexer, and the first input end of the compressor is connected to the output end of the second multiplexer. The three input ends are connected to the output end of the third multiplexer, and the first output end of the compressor is respectively connected to the first input end of the adder and the output end of the Tanh activation function submodule, and the compressor The second output end of the adder is connected to the second input end of the adder, and the output end of the adder is connected to the output end of the Tanh activation function submodule.
在本发明所述的基于脑电信号识别情绪的电路中,所述压缩器为3/1压缩器。In the circuit for recognizing emotions based on EEG signals according to the present invention, the compressor is a 3/1 compressor.
在本发明所述的基于脑电信号识别情绪的电路中,所述第一数据处理模块和第二数据处理模块包括:平方根计算子模块;In the circuit for recognizing emotions based on EEG signals according to the present invention, the first data processing module and the second data processing module include: a square root calculation sub-module;
所述平方根计算子模块采用分段线性函数算法并结合泰勒展开式进行计算。The square root calculation sub-module adopts a piecewise linear function algorithm combined with Taylor expansion for calculation.
在本发明所述的基于脑电信号识别情绪的电路中,所述平方根计算子模块包括:泰勒计算单元;In the circuit for recognizing emotions based on EEG signals according to the present invention, the square root calculation submodule includes: a Taylor calculation unit;
所述泰勒计算单元包括:前导零检测模块、补偿模块、第一移位模块、第二移位模块、第三移位模块、减法运算模块以及加法运算模块;The Taylor calculation unit includes: a leading zero detection module, a compensation module, a first shift module, a second shift module, a third shift module, a subtraction module and an addition module;
所述前导零检测模块、所述补偿模块、所述第一移位模块、所述第三移位模块以及所述加法运算模块依次连接,且所述前导零检测模块的输入端接入输入信号,所述减法运算模块的第一输入端接入所述输入信号,所述减法运算模块的第二输入端与所述前导零检测模块连接,所述减法运算模块的输出端连接所述第二移位模块的第一输入端,所述第二移位模块的第二输入端连接所述第一移位模块,所述第二移位模块的输出端连接所述加法运算模块。The leading zero detection module, the compensation module, the first shift module, the third shift module and the addition operation module are connected in sequence, and the input terminal of the leading zero detection module is connected to the input signal , the first input end of the subtraction module is connected to the input signal, the second input end of the subtraction module is connected to the leading zero detection module, and the output end of the subtraction module is connected to the second The first input terminal of the shift module, the second input terminal of the second shift module is connected to the first shift module, and the output terminal of the second shift module is connected to the addition module.
本发明还提供一种基于脑电信号识别情绪的系统,包括:以上所述的基于脑电信号识别情绪的电路。The present invention also provides a system for recognizing emotions based on EEG signals, including: the above-mentioned circuit for recognizing emotions based on EEG signals.
本发明还提供一种芯片,包括:以上所述的基于脑电信号识别情绪的电路。The present invention also provides a chip, including: the above-mentioned circuit for recognizing emotions based on electroencephalogram signals.
实施本发明的基于脑电信号识别情绪的电路、系统和芯片,具有以下有益效果:包括:特征提取单元和神经网络处理单元;神经网络处理单元包括:第一LSTM模块、第一数据处理模块、第二LSTM模块、第二数据处理模块、分类模块和输出模块;特征提取单元对原始脑电信号进行离散小波变换处理后输出特征数据;第一LSTM模块基于特征数据输出一级处理数据;第一数据处理模块根据一级处理数据输出二级处理数据;第二LSTM模块对二级处理数据进行处理后,输出三级处理数据;分类模块对三级处理数据进行分类处理后,输出分类数据;输出模块对分类数据进行处理后,输出分类结果。本发明以小波系数的能量为特征,配合LSTM网络进行情绪识别,既能降低硬件消耗,又能提高准确率。The circuit, system and chip implementing the present invention for recognizing emotions based on EEG signals have the following beneficial effects: comprising: a feature extraction unit and a neural network processing unit; the neural network processing unit includes: a first LSTM module, a first data processing module, The second LSTM module, the second data processing module, the classification module and the output module; the feature extraction unit performs discrete wavelet transform processing on the original EEG signal and then outputs the feature data; the first LSTM module outputs the primary processing data based on the feature data; the first The data processing module outputs the second-level processing data according to the first-level processing data; the second LSTM module outputs the third-level processing data after processing the second-level processing data; the classification module outputs the classification data after classifying the third-level processing data; output After the module processes the classification data, it outputs the classification result. The present invention is characterized by the energy of wavelet coefficients, cooperates with LSTM network to carry out emotion recognition, can not only reduce hardware consumption, but also improve accuracy.
附图说明Description of drawings
下面将结合附图及实施例对本发明作进一步说明,附图中:The present invention will be further described below in conjunction with accompanying drawing and embodiment, in the accompanying drawing:
图1是本发明实施例提供的基于脑电信号识别情绪的电路的原理框图;Fig. 1 is a functional block diagram of a circuit for recognizing emotions based on EEG signals provided by an embodiment of the present invention;
图2是本发明实施例提供的模糊分量和细节分量信息提取的电路结构示意图;2 is a schematic diagram of a circuit structure for extracting blur component and detail component information provided by an embodiment of the present invention;
图3是本发明实施例提供的Tanh激活函数的电路结构示意图;3 is a schematic diagram of a circuit structure of a Tanh activation function provided by an embodiment of the present invention;
图4是本发明实施例提供的3/1压缩器的电路结构示意图;FIG. 4 is a schematic diagram of a circuit structure of a 3/1 compressor provided by an embodiment of the present invention;
图5是本发明实施例提供的泰勒计算的电路结构示意图;FIG. 5 is a schematic diagram of a circuit structure of Taylor calculation provided by an embodiment of the present invention;
图6是本发明实施例提供的前导零检测的级联示意图。Fig. 6 is a schematic diagram of cascading leading zero detection provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明以小波系数的能量为特征数据,配合LSTM网络,进行情绪识别,与现有方式相比,不仅准确率得到显著提升,而且尽可能使整体设计所涉及的运行易于硬件电路实现,使硬件消耗大大降低,显著降低硬件成本。另外,本发明对神经网络中难以实现的激活函数和平方根计算进行了单独的优化设计,通过低功耗Tanh函数以及平方根运行的数字电路实现,易于硬件电路部署的脑机情绪识别神经网络及其硬件实现。The present invention uses the energy of wavelet coefficients as characteristic data, cooperates with LSTM network, and carries out emotion recognition. Compared with the existing method, not only the accuracy rate is significantly improved, but also the operation involved in the overall design is as easy as possible to realize the hardware circuit, making the hardware Consumption is greatly reduced, significantly reducing hardware costs. In addition, the present invention separately optimizes the activation function and square root calculation that are difficult to implement in the neural network, realizes the brain-computer emotion recognition neural network and its hardware implementation.
具体的,在一个优选实施例中,如图1所示,该基于脑电信号识别情绪的电路包括:特征提取单元10以及与特征提取单元10连接的神经网络处理单元20。Specifically, in a preferred embodiment, as shown in FIG. 1 , the circuit for recognizing emotions based on EEG signals includes: a
本发明实施例中,特征提取单元10对原始脑电信号进行离散小波变换处理后,输出特征数据。In the embodiment of the present invention, the
可选的,本发明实施例中,该特征提取单元10为离散小波特征提取单元。其中,该离散小波特征提取单元对原始脑电信号进行离散小波变换后,获得模糊分量和细节分量,并将从细节分量作为特征数据。该模糊分量和细节分量为与原始脑电信号对应的模糊分量和细节分量。Optionally, in the embodiment of the present invention, the
具体的,对于任意函数f(t)∈L2(R),其离散小波变换形式如下:Specifically, for any function f(t)∈L 2 (R), its discrete wavelet transform form is as follows:
(1)式中,ψ(t)为基小波或者母小波。a为伸缩因子(也称为尺度因子);b为平移因子。对尺度因子a和平移因子b进行离散化处理,即有:In formula (1), ψ(t) is the base wavelet or mother wavelet. a is the scaling factor (also known as the scale factor); b is the translation factor. The scale factor a and translation factor b are discretized, that is:
由以上可以看出,f(t)是按不同频率通道来进行分解的,这种离散化的基本思想就是选择一个适当的放大倍数在一个特定的位置研究一个函数或信号过程,然后再平衡到另一个位置继续研究。如果放大倍数过大,不能不就是尺度太小,就可以按小步长移动一个距离;反之亦然。因此,本发明实施例中,对于小尺度的高频成分,采样步长小;对于大尺度的低频成本,采样步长大。It can be seen from the above that f(t) is decomposed according to different frequency channels. The basic idea of this discretization is to choose an appropriate magnification Study a function or signal process at a specific location, and then rebalance to another location to continue the study. If the magnification is too large, it must be that the scale is too small, and you can move a distance in small steps; and vice versa. Therefore, in the embodiment of the present invention, for small-scale high-frequency components, the sampling step is small; for large-scale low-frequency components, the sampling step is large.
本发明实施例中,对原始的脑电信号经过离散小波变换后,得到了及电对应的模糊分量和细节分量,然后再选择使用小波系数的能量作为特征数据输入至神经网络处理单元20中。具体的,本发明通过选择使用小波系数的能量作为特征数据,一方面可以避免使用小波重构算法,可以显著减少计算量;另一方面,小波系数的能量可以给出信号的强度信息,并且其计算复杂度低,便于部署到硬件电路中。In the embodiment of the present invention, after discrete wavelet transform is performed on the original EEG signal, corresponding fuzzy components and detail components are obtained, and then the energy of the wavelet coefficients is selected and used as feature data to be input to the neural network processing unit 20 . Specifically, the present invention selects and uses the energy of wavelet coefficients as feature data, on the one hand, it can avoid the use of wavelet reconstruction algorithm, and can significantly reduce the amount of calculation; on the other hand, the energy of wavelet coefficients can give signal strength information, and its The computational complexity is low, and it is easy to be deployed in hardware circuits.
进一步地,为了便于工程实现,本发明实施例中,选择使用具有有限支撑集的小波函数Daubechies4(db4),按如下公式从模糊分量和细节分量中提取信号的强度信息,即:Further, in order to facilitate engineering implementation, in the embodiment of the present invention, the wavelet function Daubechies4(db4) with a limited support set is selected to extract the intensity information of the signal from the fuzzy component and the detail component according to the following formula, namely:
(3)式中Dj,k表示细节分量;(4)式中A5,k表示模糊分量;k为数据标号。(3) In the formula, D j,k represents the detail component; (4) In the formula, A 5,k represents the fuzzy component; k is the data label.
其中,本发明实施例的离散小波特征提取单元的硬件电路架构参考图2。具体的,如图2所示,本发明的离散小波特征提取单元采用级联的方式,每一级中包括了两条支路,一条支路是高通滤波支路,另一条是低通滤波支路。其中,高通滤波支路包括:高通滤波器(如图中的g)和降采样电路(如图中的↓2)。低通滤波支路包括:低通滤波器(如图中的h所示)和降采样电路(如图中的↓2)。其中,图2中的D1、D2、D3、D4为细节分量,A4为模糊分量。Wherein, refer to FIG. 2 for the hardware circuit architecture of the discrete wavelet feature extraction unit in the embodiment of the present invention. Concretely, as shown in Figure 2, the discrete wavelet feature extraction unit of the present invention adopts the mode of cascading, has included two branches in each stage, one branch is the high-pass filtering branch, and the other is the low-pass filtering branch road. Wherein, the high-pass filtering branch includes: a high-pass filter (g in the figure) and a down-sampling circuit (↓2 in the figure). The low-pass filtering branch includes: a low-pass filter (shown as h in the figure) and a downsampling circuit (↓2 in the figure). Among them, D1, D2, D3, and D4 in Fig. 2 are detail components, and A4 is a blur component.
本发明实施例中,神经网络处理单元20包括:依次与特征提取单元10连接的第一LSTM模块21、第一数据处理模块22、第二LSTM模块23、第二数据处理模块24、分类模块25以及输出模块26。In the embodiment of the present invention, the neural network processing unit 20 includes: a
其中,第一LSTM模块21基于LSTM算法对特征数据进行处理后,输出一级处理数据。第一数据处理模块22对一级处理数据进行批归一化和整合处理后,输出二级处理数据。第二LSTM模块23基于LSTM算法对二级处理数据进行处理后,输出三级处理数据。分类模块25对三级处理数据进行分类处理后,输出分类数据。输出模块26对分类数据进行处理后,输出分类结果。Wherein, the
本发明实施例中,第一LSTM模块21和第二LSTM模块23可以采用相同的硬件电路架构,但是在取值及权重方面可以不同,具体以实际计算为准。同样地,第一数据处理模块22和第二数据处理模块24也可以采用相同的硬件电路架构,但是在取值及权重方面可以不同,具体以实际计算为准。In the embodiment of the present invention, the
本发明实施例中,第一LSTM模块21和第二LSTM模块23均采用LSTM(长短期记忆网络(Longshort-termmemory,LSTM)网络算法进行计算。进一步地,为了降低功耗,同时使得运算易于硬件电路实现,本发明对LSTM网络中的Tanh激活函数进行改进。In the embodiment of the present invention, both the
本发明实施例中,第一LSTM模块21和第二LSTM模块23均包括:Tanh激活函数子模块。In the embodiment of the present invention, both the
具体的,在PWL(PieceWise-Linesar,分段线性函数)算法模型的确认阶段,除了考虑其他此类设计中所关心的平均绝对误差(Mean absolute error,MAE)外,还从硬件设计的角度增加了乘法和加法复杂度的维度,主要目的是准确评估每一个二进制位的计算过程,从而得到满足需求的算法模型。Specifically, in the confirmation phase of the PWL (PieceWise-Linesar, piecewise linear function) algorithm model, in addition to considering the mean absolute error (Mean absolute error, MAE) concerned in other such designs, it is also increased from the perspective of hardware design The dimension of multiplication and addition complexity is defined, and the main purpose is to accurately evaluate the calculation process of each binary bit, so as to obtain an algorithm model that meets the requirements.
首先,将函数自变量的范围设置为[m,n),其中,m,n为自然数。在一个优选实施例中,可取值为(-2,2)。在范围内平均分为s段。则可以按照以下公式确定PWL中第i段函数的参数ai和bi:First, set the range of the function argument to [m,n), where m,n are natural numbers. In a preferred embodiment, the possible values are (-2, 2). Divide into s segments evenly within the range. Then the parameters a i and b i of the i-th segment function in PWL can be determined according to the following formula:
绝对误差(Absolute error,AE)和MAE的定义如下:Absolute error (AE) and MAE are defined as follows:
其中,x为函数自变量,f(x)和g(x)分别是准直函数值和约值近似函数值。在使用数字电路实现算法时,将使用多路利用器(Multiplexer,MUX),即多路选择器选择该自变量的归属段。考虑到二进制的特点,在将函数曲线更远分段时,仅选取2的整数次幂作为段数,从而使得MUX的地址线位宽更加容易控制,并且尽可能保证硬件电路和软件算法在分割上的一致性。Among them, x is the independent variable of the function, f(x) and g(x) are the collimation function value and approximate function value respectively. When using a digital circuit to implement an algorithm, a multiplexer (MUX), that is, a multiplexer, is used to select the segment to which the argument belongs. Considering the characteristics of binary, when segmenting the function curve farther, only the integer power of 2 is selected as the number of segments, so that it is easier to control the bit width of the MUX address line, and as far as possible to ensure that the hardware circuit and software algorithm are divided as far as possible consistency.
本发明实施例中,所提出的PWL算法表达式如下:In the embodiment of the present invention, the proposed PWL algorithm expression is as follows:
(7)式中,x为输入的自变量。(7) In the formula, x is the input independent variable.
其中,网络的输入数据采用了10~20系统电极旋转法中的FP1、FP2、F3、C4四个电极的脑电信号按照公式(2)和公式(3)得到的信号强度信息。Among them, the input data of the network adopts the signal strength information obtained from the EEG signals of the four electrodes FP1, FP2, F3, and C4 in the 10-20 system electrode rotation method according to formula (2) and formula (3).
可选的,本发明实施例中,Tand激活函数子模块的具体电路架构可参考图3。Optionally, in the embodiment of the present invention, reference may be made to FIG. 3 for the specific circuit architecture of the Tand activation function sub-module.
具体的,如图3所示,其中,Tanh激活函数子模块包括:依次连接的移位电路211、选择电路212和加法电路213;移位电路211接入特征数据并对特征数据进行移位处理;选择电路212对经过移位电路211移位处理后的数据进行选择后,输出相应的选择数据;加法电路213对选择数据进行加法运算处理。Specifically, as shown in Figure 3, wherein, the Tanh activation function submodule includes: a sequentially connected shift circuit 211, a selection circuit 212, and an addition circuit 213; the shift circuit 211 accesses the feature data and performs shift processing on the feature data The selection circuit 212 selects the data shifted by the shift circuit 211, and then outputs the corresponding selection data; the addition circuit 213 performs addition processing on the selection data.
其中,选择电路212包括:第一多路选择器(MUX1)、第二多路选择器(MUX2)、第三多路选择器(MUX3)、反相器、与门以及或非门。Wherein, the selection circuit 212 includes: a first multiplexer (MUX1), a second multiplexer (MUX2), a third multiplexer (MUX3), an inverter, an AND gate and a NOR gate.
第一多路选择器的第一输入端与移位电路211的第一输出端连接,第一多路选择器的第二输入端与移位电路211的第二输出端连接,第一多路选择器的第三输入端与与门的输出端连接,与门的第一输入端通过反相器与移位电路211的第二输出端连接,与门的第二输入端接入输入数据,第一多路选择器的地址线接入输入数据,第一多路选择器的输出端连接加法电路213;第二多路选择器的第一输入端与移位电路211的第三输出端连接,第二多路选择器的第二输入端与移位电路211的第四输出端连接,第二多路选择器的第三输入端与移位电路211的第五输出端连接,第二多路选择器的第四输入端与移位电路211的第六输出端连接,第二多路选择器的地址线接入输入数据,第二多路选择器的输出端连接加法电路213;第三多路选择器的第四输入端连接或非门的输出端,或非门的第二输入端接入输入数据,或非门的第一输入端接入参数数据,第三多路选择器的地址线接入输入数据,第二多路选择器的输出端连接加法电路213。The first input end of the first multiplexer is connected with the first output end of the shift circuit 211, the second input end of the first multiplexer is connected with the second output end of the shift circuit 211, and the first multiplexer The third input terminal of the selector is connected to the output terminal of the AND gate, the first input terminal of the AND gate is connected to the second output terminal of the shift circuit 211 through the inverter, and the second input terminal of the AND gate is connected to the input data, The address line of the first multiplexer is connected to the input data, and the output of the first multiplexer is connected to the addition circuit 213; the first input of the second multiplexer is connected to the third output of the shift circuit 211 , the second input end of the second multiplexer is connected to the fourth output end of the shift circuit 211, the third input end of the second multiplexer is connected to the fifth output end of the shift circuit 211, and the second multiplexer The fourth input end of the way selector is connected with the sixth output end of the shift circuit 211, the address line of the second multi-way selector is connected to the input data, and the output end of the second multi-way selector is connected with the addition circuit 213; The fourth input terminal of the multiplexer is connected to the output terminal of the NOR gate, the second input terminal of the NOR gate is connected to the input data, the first input terminal of the NOR gate is connected to the parameter data, and the third multiplexer's The address line is connected to the input data, and the output terminal of the second multiplexer is connected to the adding circuit 213 .
可选的,本发明实施例中,加法电路213包括:压缩器2131和加法器2132。Optionally, in this embodiment of the present invention, the adding circuit 213 includes: a
压缩器2131的第一输入端连接第一多路选择器的输出端,压缩器2131的第二输入端连接第二多路选择器的输出端,压缩器2131的第三输入端连接第三多路选择器的输出端,压缩器2131的第一输出端分别连接加法器2132的第一输入端和Tanh激活函数子模块的输出端,压缩器2131的第二输出端连接加法器2132的第二输入端,加法器2132的输出端连接Tanh激活函数子模块的输出端。The first input end of the
为了提高电路的性能,本发明实施例中,压缩器2131采用3/1压缩器2131。如图4所示,(a)用于执行低位的本位和,(b)用于执行低位中最高位的进位,(c)用于执行高位的运算。通过采用3/1压缩器2131,仅保留计算部分低有效位中的最高位的进位(carry)信息,只使用或门来获得低有效位所有位的本位和(sum),可以大大减小电路的面积和传播时间,降低功耗,提升效率。In order to improve the performance of the circuit, in the embodiment of the present invention, the
可选的,本发明实施例中,第一数据处理模块22和第二数据处理模块24均采用批归一化算法(即Batchnormalization,BN算法)实现,使用批归一化可以使每层输入数据的分布相对稳定,加速模型的学习速度。Optionally, in the embodiment of the present invention, both the first
可选的,本发明实施例中,第一数据处理模块22和第二数据处理模块24均包括:平方根计算子模块。其中,该平方根计算子模块采用分段线性函数算法并结合泰勒展开式进行计算。Optionally, in this embodiment of the present invention, both the first
即在进行平方根运行设计的时候,本发明使用了PWL算法与泰勒展开式相结合的方式,通过泰勒公式的引入,可以避免因使用PWL算法时,当自变量取值较小时误差超出预期范围而增加硬件资源消耗的问题。即本发明从泰勒公式的角度入手,既能提高准确度,也能减少硬件资源消耗。That is, when carrying out square root operation design, the present invention has used the mode that PWL algorithm and Taylor's expansion formula are combined, through the introduction of Taylor's formula, can avoid due to when using PWL algorithm, when the independent variable takes a small value, the error exceeds the expected range. Issues that increase hardware resource consumption. That is, the present invention starts from the perspective of the Taylor formula, which can not only improve the accuracy, but also reduce the consumption of hardware resources.
具体的,在一个优选实施例中,该平方根计算子模块包括:泰勒计算单元。Specifically, in a preferred embodiment, the square root calculation submodule includes: a Taylor calculation unit.
如图5所示,该泰勒计算单元包括:前导零检测模块、补偿模块、第一移位模块、第二移位模块、第三移位模块、减法运算模块以及加法运算模块。As shown in FIG. 5 , the Taylor calculation unit includes: a leading zero detection module, a compensation module, a first shift module, a second shift module, a third shift module, a subtraction module and an addition module.
前导零检测模块、补偿模块、第一移位模块、第三移位模块以及加法运算模块依次连接,且前导零检测模块的输入端接入输入信号,减法运算模块的第一输入端接入输入信号,减法运算模块的第二输入端与前导零检测模块连接,减法运算模块的输出端连接第二移位模块的第一输入端,第二移位模块的第二输入端连接第一移位模块,第二移位模块的输出端连接加法运算模块。The leading zero detection module, the compensation module, the first shift module, the third shift module and the addition module are connected in sequence, and the input terminal of the leading zero detection module is connected to the input signal, and the first input terminal of the subtraction module is connected to the input signal. signal, the second input of the subtraction module is connected to the leading zero detection module, the output of the subtraction module is connected to the first input of the second shift module, and the second input of the second shift module is connected to the first shift module, and the output end of the second shift module is connected to the addition operation module.
其中,前导零检测模块用于实现对二进制数中最高有效1进行检测;补偿模块对数据进行补偿处理,以提高数据的稳定性;第一移位模块、第二移位模块以及第三移位模块根据相应的移位需求对数据进行移位处理,减法运算模块执行减法运算;加法运算模块执行加法运算。Among them, the leading zero detection module is used to detect the most significant 1 in the binary number; the compensation module compensates the data to improve the stability of the data; the first shift module, the second shift module and the third shift module The module shifts the data according to the corresponding shifting requirements, the subtraction module executes subtraction, and the addition module executes addition.
进一步地,为了提高前导零检测的检测速度,本发明实施例中,该前导零检测模块采用分段检测的方式,具体如图6所示。如图6所示,LOD表示前导零检测模块,对于28位的二进制数,其低16位为一组,高12位为一组,在进行前导零检测时,低16位和高12位分开单独检测。Further, in order to improve the detection speed of leading zero detection, in the embodiment of the present invention, the leading zero detection module adopts a segmented detection method, as shown in FIG. 6 . As shown in Figure 6, LOD represents the leading zero detection module. For a 28-bit binary number, the lower 16 bits form a group and the upper 12 bits form a group. When performing leading zero detection, the lower 16 bits and upper 12 bits are separated. Tested individually.
本发明实施例中,输出模块26可采用Sigmoid函数。其中,分类模块25进行的是多标签分类。由于进行的是多标签分类,最终的激活函数选用的是Sigmoid函数,对于最终共8类的多标签分类准确度可以达到72%,显然,可以有效提升准确度。In the embodiment of the present invention, the output module 26 may use a Sigmoid function. Among them, the classification module 25 performs multi-label classification. Since the multi-label classification is performed, the final activation function is the Sigmoid function. For the final multi-label classification of 8 categories, the accuracy can reach 72%. Obviously, the accuracy can be effectively improved.
本发明还提供一种基于脑电信号识别情绪的系统,包括:本发明实施例公开的基于脑电信号识别情绪的电路。The present invention also provides a system for recognizing emotions based on EEG signals, including: the circuit for recognizing emotions based on EEG signals disclosed in the embodiments of the present invention.
本发明还提供一种芯片,该芯片包括:本发明实施例公开的基于脑电信号识别情绪的电路。The present invention also provides a chip, which includes: the circuit for recognizing emotions based on electroencephalogram signals disclosed in the embodiments of the present invention.
本发明基于脑电信号识别情绪的电路可以适用于FPGA运算、深度学习运算等数据计算中。另外,本发明基于脑电信号识别情绪的电路还可以应用于抒情障碍相关领域、虚拟现实游戏等领域。The circuit for recognizing emotions based on EEG signals of the present invention can be applied to data calculations such as FPGA calculations and deep learning calculations. In addition, the circuit for identifying emotions based on EEG signals of the present invention can also be applied to fields related to lyric disorder, virtual reality games, and the like.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for relevant details, please refer to the description of the method part.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the possible For interchangeability, in the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be directly implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other Any other known storage medium.
以上实施例只为说明本发明的技术构思及特点,其目的在于让熟悉此项技术的人士能够了解本发明的内容并据此实施,并不能限制本发明的保护范围。凡跟本发明权利要求范围所做的均等变化与修饰,均应属于本发明权利要求的涵盖范围。The above embodiments are only to illustrate the technical conception and characteristics of the present invention. The purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly, and cannot limit the protection scope of the present invention. All equivalent changes and modifications made in accordance with the scope of the claims of the present invention shall fall within the scope of the claims of the present invention.
Claims (10)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310185223.9A CN116304812A (en) | 2023-02-22 | 2023-02-22 | Circuits, systems and chips for recognizing emotions based on EEG signals |
| PCT/CN2023/141257 WO2024174713A1 (en) | 2023-02-22 | 2023-12-22 | Electroencephalogram-based emotion recognition circuit and system, and chip |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310185223.9A CN116304812A (en) | 2023-02-22 | 2023-02-22 | Circuits, systems and chips for recognizing emotions based on EEG signals |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116304812A true CN116304812A (en) | 2023-06-23 |
Family
ID=86797111
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310185223.9A Pending CN116304812A (en) | 2023-02-22 | 2023-02-22 | Circuits, systems and chips for recognizing emotions based on EEG signals |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN116304812A (en) |
| WO (1) | WO2024174713A1 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2024174713A1 (en) * | 2023-02-22 | 2024-08-29 | 深圳大学 | Electroencephalogram-based emotion recognition circuit and system, and chip |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20090172506A1 (en) * | 2007-12-26 | 2009-07-02 | Fujitsu Limited | Semiconductor device and signal processing method |
| CN113627518A (en) * | 2021-08-07 | 2021-11-09 | 福州大学 | A method for implementing multi-channel convolution-recurrent neural network EEG emotion recognition model using transfer learning |
| CN113935480A (en) * | 2021-11-12 | 2022-01-14 | 成都甄识科技有限公司 | Activation Function Accelerated Processing Unit for Online Learning of Neural Networks |
| CN115474947A (en) * | 2022-08-25 | 2022-12-16 | 西安电子科技大学 | Deep learning-based two-class basic emotion intensity electroencephalogram signal identification method |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11567574B2 (en) * | 2020-09-22 | 2023-01-31 | Optum Technology, Inc. | Guided interaction with a query assistant software using brainwave data |
| CN112364697B (en) * | 2020-10-14 | 2021-11-30 | 陕西师范大学 | Electroencephalogram emotion recognition method based on R-LSTM model |
| CN114699078B (en) * | 2022-03-08 | 2025-02-11 | 重庆邮电大学 | An emotion recognition method and system based on EEG signals of a small number of channels |
| CN116304812A (en) * | 2023-02-22 | 2023-06-23 | 深圳大学 | Circuits, systems and chips for recognizing emotions based on EEG signals |
-
2023
- 2023-02-22 CN CN202310185223.9A patent/CN116304812A/en active Pending
- 2023-12-22 WO PCT/CN2023/141257 patent/WO2024174713A1/en not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20090172506A1 (en) * | 2007-12-26 | 2009-07-02 | Fujitsu Limited | Semiconductor device and signal processing method |
| CN113627518A (en) * | 2021-08-07 | 2021-11-09 | 福州大学 | A method for implementing multi-channel convolution-recurrent neural network EEG emotion recognition model using transfer learning |
| CN113935480A (en) * | 2021-11-12 | 2022-01-14 | 成都甄识科技有限公司 | Activation Function Accelerated Processing Unit for Online Learning of Neural Networks |
| CN115474947A (en) * | 2022-08-25 | 2022-12-16 | 西安电子科技大学 | Deep learning-based two-class basic emotion intensity electroencephalogram signal identification method |
Non-Patent Citations (1)
| Title |
|---|
| 贾文皓等: ""适用能源互联网非线性气流方程组的线性优化求解模型"", 中国电机工程学报, vol. 40, no. 24, 20 December 2020 (2020-12-20), pages 7938 - 7949 * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2024174713A1 (en) * | 2023-02-22 | 2024-08-29 | 深圳大学 | Electroencephalogram-based emotion recognition circuit and system, and chip |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2024174713A1 (en) | 2024-08-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Salamat et al. | Accelerating hyperdimensional computing on fpgas by exploiting computational reuse | |
| CN112381097A (en) | Scene semantic segmentation method based on deep learning | |
| CN111898730A (en) | Structure optimization design method for accelerating by using graph convolution neural network structure | |
| CN114265937A (en) | Intelligent classification analysis method and system of scientific and technological information, storage medium and server | |
| CN112418320A (en) | A kind of enterprise association relationship identification method, device and storage medium | |
| CN114821059A (en) | Salient object detection method and system based on boundary enhancement | |
| CN113377909B (en) | Paraphrasing analysis model training method and device, terminal equipment and storage medium | |
| Dominic et al. | Multilingual sentiment analysis using deep-learning architectures | |
| CN116304812A (en) | Circuits, systems and chips for recognizing emotions based on EEG signals | |
| Zhang et al. | Scaling up your kernels: Large kernel design in convnets towards universal representations | |
| Ma et al. | TriConvUNeXt: a pure CNN-Based lightweight symmetrical network for biomedical image segmentation | |
| CN112231476B (en) | Improved graphic neural network scientific literature big data classification method | |
| Li et al. | Cross-attention-map-based regularization for adversarial domain adaptation | |
| Mohanty et al. | Pruning techniques for artificial intelligence networks: a deeper look at their engineering design and bias: the first review of its kind | |
| Wróbel et al. | Compression of convolutional neural network for natural language processing | |
| CN114266279B (en) | A point cloud feature extraction method and device based on complex network expression | |
| CN113626827B (en) | A smart contract vulnerability detection method, system, device, medium, and terminal | |
| Phu et al. | Design and implementation of configurable convolutional neural network on FPGA | |
| CN106682732A (en) | Gaussian error function circuit applied to neural networks | |
| CN120068978A (en) | Small sample fine granularity block-level model pruning method for visual transducer model | |
| Mohaidat et al. | Curvature-Based Piecewise Linear Approximation Method of GELU Activation Function in Neural Networks | |
| CN120012822A (en) | A knowledge reasoning method for automobile network security based on graph neural network | |
| Chen et al. | Deep-Learning-Based Proxy Modeling for Microscopic Process of Plasma Etching | |
| CN118644748A (en) | Training sample generation method for pathological cell classification model | |
| CN118278349A (en) | Power distribution network parallel acceleration simulation method combining machine learning hot spot detection |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |