Emotion classification method and system for heart electromagnetic signals of heart rate variability based on topology analysis
By acquiring highly sensitive magnetocardiogram signals and combining them with strict magnetic shielding and multi-level filtering preprocessing, topological data analysis and dual-branch deep learning model fusion are performed to solve the problems of high signal noise and weak model generalization ability in existing emotion recognition technologies, thus achieving highly accurate and robust emotion classification.
Patent Information
- Application Number
- CN202511515493.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-01-16
AI Technical Summary
Existing emotion recognition technologies suffer from problems such as high signal noise, insufficient feature extraction, and weak model generalization ability. In particular, they are difficult to effectively capture the nonlinear features of heart rate variability and achieve robust cross-individual emotion classification under small sample physiological data.
An emotion classification method based on cardiac electromagnetic signals of heart rate variability using topology analysis is adopted. By acquiring high-sensitivity magnetocardiogram signals, combined with strict magnetic shielding and multi-level filtering preprocessing, topological data analysis of RR interval sequences is performed to generate persistent graph topological feature points. Feature fusion and classification are then performed using a two-branch deep learning model.
It significantly improves signal quality and anti-interference ability, realizes quantitative characterization of the nonlinear dynamic structure of heart rate variability, enhances the accuracy, robustness and cross-individual generalization ability of emotion classification, and alleviates the overfitting problem under small sample size.
Smart Images

Figure CN121337353A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of biomedical signal processing and affective computing, and in particular to an emotion classification method and system for heart electromagnetic signals based on topological analysis of heart rate variability. BACKGROUND
[0002] Existing emotion recognition technology mainly has the defects of single signal limitation, insufficient feature extraction and weak model generalization ability, and emotion classification based on electrocardiogram is limited by body surface electrode contact noise, motion artifacts and low spatial resolution, it is difficult to capture subtle autonomic nervous activity, traditional time-frequency domain heart rate variability features have low sensitivity to nonlinear emotional fluctuations, and there is a lack of quantitative analysis of the topological structure of cardiac electrical activity, in addition, machine learning models rely on manual features, and deep learning models are prone to overfitting in small sample physiological data.
[0003] At present, the present application based on electrocardiogram or magnetocardiogram shows stronger robustness in the situation of large inter-individual emotional differences, which provides a new idea for improving the universality and generalization ability of emotion classification model, the present application has important theoretical value and application prospect, not only expands the technical boundary of traditional emotion recognition method, but also provides important support for mental health management and intelligent emotional interaction, and has broad development prospect. SUMMARY
[0004] In view of the problems existing in the prior art, the present application is proposed.
[0005] Therefore, the problem to be solved by the present application is how to overcome the problem of low classification accuracy caused by large signal noise, insufficient feature extraction and weak model generalization ability of existing emotion recognition methods, especially the difficulty of effectively capturing nonlinear features of heart rate variability and realizing cross-individual robust emotion classification under small sample physiological data.
[0006] To solve the above technical problems, the present application provides the following technical scheme:
[0007] In a first aspect, the embodiments of the present application provide a method for emotion classification of heart electromagnetic signals based on topological analysis of heart rate variability, which comprises: collecting multi-channel magnetocardiogram signals or electrocardiogram signals of a human heart, and preprocessing the magnetocardiogram signals or electrocardiogram signals; locating R waves and extracting RR interval sequences, wherein R refers to a peak point of each heartbeat in an electrocardio signal, and RR refers to a time interval between adjacent two heartbeat peak points; performing topological data analysis on the RR interval sequences, generating a persistence diagram through Lower-Star sub-level set filtering and Vietoris-Rips complex calculation, and extracting statistics of topological feature points of the persistence diagram as topological features; inputting the RR interval sequences and the topological features into a double-branch deep learning model, performing fusion through a time sequence branch, a topological branch and a fusion layer, generating a fusion vector, and classifying an emotional state based on the fusion vector.
[0008] As a preferred scheme of the method for emotion classification of heart electromagnetic signals based on topological analysis of heart rate variability, the magnetocardiogram signals are collected by an optically pumped magnetometer array, the optically pumped magnetometer array includes 64 sensors to cover a 125*125 mm2 area in an 8*8 layout, the collection by the optically pumped magnetometer array is performed in a multi-layer magnetic shielding barrel, the residual magnetism of the shielding environment is less than 5 nT, the z-axis component of the magnetic field is recorded during the collection, and the sampling rate of the z-axis component of the magnetic field is greater than or equal to 250 Hz.
[0009] As a preferred scheme of the method for emotion classification of heart electromagnetic signals based on topological analysis of heart rate variability, the preprocessing of the magnetocardiogram signals or electrocardiogram signals includes power interference filtering, baseline correction and motion artifact elimination.
[0010] Low-frequency noise, power interference and motion artifacts are removed through high-pass filter and notch filter technologies.
[0011] The removal of low-frequency noise, power interference and motion artifacts includes four-stage cascade filtering of noise components of the magnetocardiogram signals or electrocardiogram signals, and separation of motion artifacts based on a joint algorithm of independent component analysis (ICA) and empirical mode decomposition (EMD), wherein the EMD refers to decomposition of residual noise into an intrinsic mode function, and the ICA refers to decoupling of components of the magnetocardiogram signals or electrocardiogram signals through optimization of an objective function, and the specific calculation formula is:
[0012]
[0013] wherein, represents an optimization objective function, W represents a demixing matrix, n represents the number of signal channels, yi represents an output signal of the i th channel after matrix W transformation, represents the entropy of the i th output signal yi. determinant of the matrix W.
[0014] As a preferred scheme of the emotion classification method of the heart electromagnetic signal of heart rate variability based on topological analysis, wherein: the positioning R wave and extracting RR interval sequence includes detecting R wave by using adaptive double threshold method, generating RR interval sequence and resampling to 4Hz;
[0015] The lower limit of the interval between two adjacent heartbeat peak points is 0.6 seconds, and the generated RR interval sequence is resampled to 4Hz to form input data.
[0016] As a preferred scheme of the emotion classification method of the heart electromagnetic signal of heart rate variability based on topological analysis, wherein: the topological data analysis includes
[0017] Takens embedding is performed on the RR interval sequence;
[0018] The 0-dimensional persistent diagram is calculated by Lower-Star sub-level set filtering, and the intermediate value and life of each point are extracted;
[0019] The 0-dimensional and 1-dimensional persistent diagrams are calculated by Vietoris-Rips complex;
[0020] 16-dimensional statistics are extracted from the persistent diagram, including the mean, standard deviation, skewness, kurtosis, percentile and entropy of M and L, to form a 48-dimensional topological feature vector;
[0021] The formula of the Takens embedding is:
[0022]
[0023] Wherein, N is the sequence length, is the maximum Lyapunov exponent.
[0024] As a preferred scheme of the emotion classification method of the heart electromagnetic signal of heart rate variability based on topological analysis, wherein: the L refers to the stability index calculated by the birth and death time point pair (b, d) of topological features, and the M refers to the position parameter of the birth and death time point pair (b, d);
[0025] The formula for calculating the stability index of the birth and death time point pair (b, d) is:
[0026]
[0027] The formula for calculating the position parameter of the birth and death time point pair (b, d) is:
[0028]
[0029] Wherein, L is the duration of life, b is the birth time, d is the death time, M is the location parameter.
[0030] As a preferred scheme of the emotion classification method of the cardiac electromagnetic signal of heart rate variability based on topological analysis of the application, wherein: the double-branch deep learning model includes extracting time domain features from RR interval sequences by one-dimensional deep separable convolution through a time sequence branch, processing persistent statistical features through a topological branch, aligning and fusing through a cross-attention mechanism, and the formula of the gate residual connection generated by the full connection layer is:
[0031]
[0032] Wherein, is the comprehensive feature vector after gate fusion, is the gate value, is the attention mechanism output feature, is the time sequence feature, is the reverse gate value.
[0033] Using five-fold cross-validation, data augmentation is performed by adding Gaussian noise, time warping and amplitude scaling, and a composite loss function composed of label smoothing cross entropy and adaptive Focal Loss weighting is designed, the Focal Loss is a loss function, the loss function includes an adjustment factor γ, the γ satisfies the formula:
[0034]
[0035] Wherein, γ is the adjustment factor;
[0036] The fusion through the time sequence branch, the topological branch and the fusion layer includes processing the fusion features by using a double-branch neural network architecture, the time sequence branch uses one-dimensional deep separable convolution, the convolution kernel size is configured in an increasing sequence of 3 / 5 / 7 / 9, and multi-scale rhythm patterns are captured, the topological branch encodes 48-dimensional topological data analysis features through a full connection layer, and an attention weight matrix is calculated according to the information of the fusion features:
[0037]
[0038] Wherein, M is the inhibition of redundant feature channels, is the attention weight output, Q is the query, K is the key, is the dot product matrix of the query and the key, is the dimension of the key, and softmax is a normalization function.
[0039] Secondly, embodiments of the present invention provide an emotion classification system for cardiac electromagnetic signals based on heart rate variability according to topological analysis, comprising: a signal acquisition module, which acquires MCG signals based on a sensor array and a magnetic shielding device;
[0040] The preprocessing module performs power frequency filtering and baseline correction;
[0041] The feature extraction module performs topological feature generation;
[0042] The dual-branch classification module includes a temporal encoder, a topological encoder, and a cross-attention fusion unit;
[0043] The output module generates emotion classification results and a visualization report.
[0044] Thirdly, embodiments of the present invention provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement any step of the above-described emotion classification method for cardiac electromagnetic signals based on heart rate variability according to topology analysis.
[0045] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the above-described method for classifying the emotion of cardiac electromagnetic signals based on heart rate variability according to topology analysis.
[0046] The beneficial effects of this invention are as follows: By acquiring high-sensitivity magnetocardiogram (MCG) signals and combining them with strict magnetic shielding and multi-level filtering preprocessing, this invention significantly improves signal quality and anti-interference capability. It innovatively introduces topological data analysis (TDA) to reconstruct the phase space of RR interval sequences and extract persistent homology features, achieving a quantitative characterization of the nonlinear dynamic structure of heart rate variability and compensating for the shortcomings of traditional time-frequency domain features. Furthermore, a bi-branch deep learning model is designed, fusing temporal morphological features and topological structural features, and adaptive feature fusion is achieved through cross-attention mechanisms and gated residual connections, enhancing the model's ability to capture key physiological patterns. Combined with data augmentation and composite loss function training strategies, it effectively alleviates the overfitting problem under small sample sizes, significantly improving the accuracy, robustness, and cross-individual generalization ability of emotion classification, providing a new method for emotion computing. Attached Figure Description
[0047] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0048] Figure 1 A flowchart illustrating an emotion classification method for cardiac electromagnetic signals based on heart rate variability derived from topological analysis, provided as an embodiment of the present invention.
[0049] Figure 2 The flowchart below illustrates a specific process for classifying the emotion of cardiac electromagnetic signals based on heart rate variability using topological analysis, as provided in an embodiment of the present invention.
[0050] Figure 3 This is a schematic diagram of the structure of a medium for an emotion classification method of cardiac electromagnetic signals based on heart rate variability provided in an embodiment of the present invention.
[0051] Figure 4 This invention provides a schematic diagram of the structure of a computing device for an emotion classification method based on heart rate variability of cardiac electromagnetic signals. Detailed Implementation
[0052] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0053] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0054] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0055] This invention is described in detail with reference to the schematic diagrams. When detailing the embodiments of this invention, for ease of explanation, the cross-sectional views illustrating the device structure may be partially enlarged, not adhering to the usual scale. Furthermore, the schematic diagrams are merely examples and should not be construed as limiting the scope of protection of this invention. In actual fabrication, the three-dimensional spatial dimensions of length, width, and depth should be included.
[0056] Furthermore, in the description of this invention, it should be noted that the terms "upper," "lower," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are used solely for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. In addition, the terms "first," "second," or "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0057] Unless otherwise explicitly specified and limited, the terms "installation," "connection," and "joining" in this invention should be interpreted broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; similarly, they can refer to mechanical connections, electrical connections, or direct connections, or indirect connections through an intermediate medium, or internal connections between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0058] Example
[0059] Reference Figures 1-4 This is the first embodiment of the present invention, which provides an emotion classification method for cardiac electromagnetic signals based on heart rate variability through topological analysis, including:
[0060] S1: Collect multi-channel magnetocardiogram (MCG) or electrocardiogram (ECG) signals from the human heart and preprocess the MCG or ECG signals.
[0061] The magnetocardiogram (MCG) signal was acquired via an optically pumped magnetometer array, which consisted of 64 sensors arranged in an 8×8 configuration covering a 125×125 mm² area. The acquisition was performed within a multi-layered magnetically shielded enclosure, with residual magnetism <5 nT shielded from environmental magnetic field interference. The z-axis component of the magnetic field was recorded during acquisition, and the sampling rate of the z-axis component was ≥250 Hz.
[0062] Preferably, the parameter settings are based on a comprehensive optimization of the physical characteristics of the magnetocardiogram (MCG) signal, anatomical requirements, and the actual measurement environment. Sixty-four sensors are arranged in an 8×8 array, covering a 125×125 mm area. This is to completely capture the magnetic field distribution of cardiac electrical activity on the chest wall surface, ensuring sufficiently dense spatial sampling to reflect the spatial variation characteristics of the MCG, while also considering system integration and cost. The multi-layered magnetic shielding design is to isolate the Earth's magnetic field and environmental electromagnetic interference, keeping the residual background magnetic field at an extremely low level, thus ensuring the detectability of weak MCG signals. The vertical component (z-axis) of the magnetic field is selected for recording because the magnetic field generated by the equivalent current source of the heart has the strongest signal and most obvious characteristics in this direction, which is beneficial to improving the signal-to-noise ratio. The sampling rate is no less than 250 Hz to meet the requirement of accurately capturing the high-frequency components of heart rate variability, ensuring the accuracy of R-wave localization and RR interval extraction. This value is determined based on the physiological range of human heart rate changes and signal reconstruction theory, ensuring information integrity while avoiding data redundancy. These parameters together constitute the technical foundation for high-quality MCG signal acquisition.
[0063] Preprocessing of magnetocardiogram or electrocardiogram signals includes power line interference filtering, baseline correction, and motion artifact removal;
[0064] Low-frequency noise, power frequency interference, and motion artifacts are removed using high-pass and notch filter techniques.
[0065] Removing low-frequency noise, power frequency interference, and motion artifacts involves processing the noise components of the magnetocardiogram (MCG) or electrocardiogram (ECG) signal through a four-stage cascaded filtering process. Motion artifacts are then separated using a joint algorithm based on Independent Component Analysis (ICA) and Empirical Mode Decomposition (EMD). EMD decomposes residual noise into intrinsic mode functions, while ICA decouples the components of the MCG or ECG signal by optimizing the objective function. The specific calculation formula is as follows:
[0066]
[0067] in, Let W represent the objective function, n represent the number of signal channels, and yi represent the output signal of the i-th channel after transformation by matrix W. This represents the entropy of the i-th output signal yi. This represents the determinant of matrix W.
[0068] S2: Locate the R wave and extract the RR interval sequence. R refers to the peak point of each heartbeat in the electrocardiogram signal, and RR refers to the time interval between two adjacent heartbeat peak points.
[0069] The process of locating the R wave and extracting the RR interval sequence includes using an adaptive double threshold method to detect the R wave, generating the RR interval sequence, and resampling it to 4Hz.
[0070] The lower limit of the interval between two adjacent heart rate peaks is 0.6 seconds, and the generated RR interval sequence is resampled at 4Hz to form the input data.
[0071] Furthermore, the feature extraction stage employs a dual-modal strategy. R-wave detection is based on adaptive dual thresholds: a lower limit of 0.6 seconds for the interval between adjacent peaks (corresponding to a maximum heart rate of 100 bpm), and an amplitude threshold set to 1.8 times the local root mean square of the signal. The generated RR interval sequence is resampled at 4 Hz to form the basic input data. Time-frequency domain features include statistical indicators such as SDNN (standard deviation of normal sinus intervals) and RMSSD (root mean square difference between adjacent RR intervals), as well as frequency domain parameters such as VLF power (0.003-0.04 Hz) and LF / HF ratio (power ratio of 0.04-0.15 Hz to 0.15-0.4 Hz).
[0072] S3: Perform topological data analysis on the RR interval series, generate a persistent graph through Lower-Star subset filtering and Vietoris-Rips complex calculation, and extract the statistics of the topological feature points of the persistent graph as topological features.
[0073] Topology data analysis includes:
[0074] Takens embedding of RR interval sequences;
[0075] The zero-endurance longevity graph is calculated by Lower-Star subset filtering, and the median value and lifetime of each point are extracted.
[0076] Computation of 0-dimensional and 1-dimensional maintenance graphs using Vietoris-Rips complexes;
[0077] Sixteen statistical measures are extracted from the persistent graph, including the mean, standard deviation, skewness, kurtosis, percentile and entropy of M and L, to form a 48-dimensional topological feature vector.
[0078] The formula for Takens embedding is:
[0079]
[0080] Where N is the sequence length, It is the maximum Lyapunov index.
[0081] Furthermore, topological data analysis was performed on the extracted RR interval sequences to uncover the nonlinear dynamic structure behind heart rate variability. First, the one-dimensional time series was extended into a high-dimensional point cloud using phase space reconstruction technology. This process, based on system dynamics theory, selected appropriate embedding dimensions and time delays to ensure that the reconstructed geometric structure could accurately reflect the intrinsic state space of the heart rhythm. Subsequently, the Lower-Star subset filtering method was used to construct a topological structure layer by layer along the direction of signal amplitude variation. This was used to identify stable connected components in the signal and their evolution process, and to generate a zero-durability graph that reflects the aggregation and separation characteristics of heartbeat intervals at different scales. Simultaneously, the Vietoris-Rips complex method was used to progressively construct a topological connection network based on the distance relationships between points in the point cloud. The continuous cohomology features of zero-dimensional (representing connected regions) and one-dimensional (representing ring structures) components were calculated to form a persistence graph, which was used to characterize the periodic patterns and structural stability in heart rate fluctuations. For the three types of persistent graphs generated, sixteen statistical features are extracted from them, including indicators such as central tendency, dispersion, distribution skewness, kurtosis, key percentile values, and information complexity of the birth and death positions of topological points. Finally, the statistics of the three types of graphs are combined into a forty-eight-dimensional topological feature vector to comprehensively characterize the geometric and structural characteristics of heart rate variability in the topological space, providing highly discriminative input for subsequent emotion classification.
[0082] S3.1: L refers to the stability index of the birth and death time point pair (b, d) of the topological feature, and M refers to the position parameter of the birth and death time point pair (b, d);
[0083] The formula for calculating the stability index for the birth-death time point pair (b, d) is as follows:
[0084]
[0085] The formula for the positional parameter of the birth and death time points relative to (b, d) is:
[0086]
[0087] Where L is the lifetime, b is the birth time, d is the death time, and M is the location parameter.
[0088] S4: Input the RR interval sequence and topological features into a two-branch deep learning model, and fuse them through temporal branch, topological branch and fusion layer to generate a fusion vector, and classify the sentiment state based on the fusion vector.
[0089] The dual-branch deep learning model includes a temporal branch that extracts temporal features from RR interval sequences through one-dimensional depthwise separable convolutions, a topological branch that processes persistent statistical features, and alignment via a cross-attention mechanism followed by fusion through gated residual connections. The formula for generating the gated residual connections from the fully connected layers is as follows:
[0090]
[0091] in, This is the comprehensive feature vector after gating and fusion. This is the gate value. Output features for the attention mechanism. As a time series feature, This is the reverse gating value;
[0092] Five-fold cross-validation is employed, and data augmentation is performed by adding Gaussian noise, time warp, and amplitude scaling. A composite loss function is designed, consisting of label smoothed cross-entropy and adaptive Focal Loss weighting. Focal Loss is the loss function, which includes an adjustment factor γ, and γ satisfies the following formula:
[0093]
[0094] Where γ is the adjustment factor;
[0095] Fusion is achieved through temporal branching, topological branching, and a fusion layer. This involves processing fusion features using a dual-branch neural network architecture. The temporal branch employs one-dimensional depthwise separable convolutions with kernel sizes configured in an increasing sequence of 3 / 5 / 7 / 9 to capture multi-scale rhythmic patterns. The topological branch encodes 48-dimensional topological data analysis features through fully connected layers, and calculates the attention weight matrix based on the information from the fusion features.
[0096]
[0097] Where M represents the suppressed redundant feature channel, The output is the attention weight, where Q is the query and K is the key. To query the dot product matrix with the key, Let be the dimension of the key, and softmax be the normalization function.
[0098] Furthermore, the attention weight matrix is used to dynamically measure the correlation between temporal features and topological features, highlighting the feature parts that contribute more to emotion discrimination; the weighted fusion features more accurately reflect the differences in emotional state, and after being connected by gated residuals, they are input into the classifier, directly improving the accuracy and robustness of emotion classification.
[0099] In a preferred embodiment, an emotion classification system based on heart rate variability of cardiac electromagnetic signals includes a signal acquisition module for acquiring MCG signals using a sensor array and a magnetic shielding device; a preprocessing module for performing power frequency filtering and baseline correction; a feature extraction module for performing topological feature generation; a two-branch classification module including a temporal encoder, a topological encoder, and a cross-attention fusion unit; and an output module for generating emotion classification results and a visualization report.
[0100] The above-mentioned unit modules can be embedded in the processor of the computer device in hardware form or independent of it, or they can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of the above modules.
[0101] In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, memory, a communication interface, a display screen, and an input device connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The communication interface of the computer device is used for wired or wireless communication with external terminals. Wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen of the computer device may be an LCD screen or an e-ink display screen. The input device of the computer device may be a touch layer covering the display screen, or buttons, a trackball, or a touchpad located on the casing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0102] In summary, this invention significantly improves signal quality and anti-interference capability by acquiring high-sensitivity magnetocardiogram (MCG) signals and combining them with strict magnetic shielding and multi-level filtering preprocessing. It innovatively introduces topological data analysis (TDA) to reconstruct the phase space of RR interval sequences and extract persistent homology features, achieving a quantitative characterization of the nonlinear dynamic structure of heart rate variability and overcoming the shortcomings of traditional time-frequency domain features. Furthermore, a bi-branch deep learning model is designed to fuse temporal morphological features and topological structural features, and adaptive feature fusion is achieved through cross-attention mechanisms and gated residual connections, enhancing the model's ability to capture key physiological patterns. Combined with data augmentation and composite loss function training strategies, the overfitting problem under small sample sizes is effectively alleviated, significantly improving the accuracy, robustness, and cross-individual generalization ability of emotion classification, providing a new method for emotion computing.
[0103] After introducing the method and system of exemplary embodiments of the present invention, the following references are made.Figure 3 A computer-readable storage medium according to exemplary embodiments of the present invention will be described, please refer to... Figure 3 The computer-readable storage medium shown is an optical disc 30, on which a computer program (i.e., a program product) is stored. When the computer program is run by a processor, it implements the steps described in the above-described method implementation, such as: acquiring multi-channel magnetocardiogram (MCG) or electrocardiogram (ECG) signals from the human heart; preprocessing the MCG or ECG signals; locating the R wave and extracting the RR interval sequence, where R refers to the peak point of each heartbeat in the ECG signal, and RR refers to the time interval between two adjacent heartbeat peak points; performing topological data analysis on the RR interval sequence, generating a persistent graph through Lower-Star subset filtering and Vietoris-Rips complex calculation, and extracting the statistics of the topological feature points of the persistent graph as topological features; inputting the RR interval sequence and topological features into a two-branch deep learning model, fusing them through temporal branching, topological branching, and a fusion layer to generate a fusion vector, and classifying emotional states based on the fusion vector. The specific implementation methods of each step will not be repeated here.
[0104] It should be noted that examples of computer-readable storage media may also include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical and magnetic storage media, which will not be elaborated here.
[0105] After introducing the methods and media of exemplary embodiments of the present invention, the following references are made. Figure 4 A computational device for adaptive recovery of low-voltage power grid self-healing control according to an exemplary embodiment of the present invention.
[0106] Figure 4 A block diagram is shown of an exemplary computing device 40 suitable for implementing embodiments of the present invention. The computing device 40 may be a computer system or a server. Figure 4 The computing device 40 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0107] like Figure 4 As shown, the components of computing device 40 may include, but are not limited to: one or more processors or processing units 401, system memory 402, and bus 403 connecting different system components (including system memory 402 and processing unit 401).
[0108] The computing device 40 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computing device 40, including volatile and non-volatile media, and removable and non-removable media.
[0109] System memory 402 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 4021 and / or cache memory 4022. Computing device 40 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, ROM 4023 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 4 (Not shown in the image, usually referred to as "hard drive"). Although not shown in... Figure 4 The diagram illustrates that disk drives for reading and writing to removable non-volatile disks (e.g., "floppy disks") and optical disc drives for reading and writing to removable non-volatile optical discs (e.g., CD-ROMs, DVD-ROMs, or other optical media) can be provided. In these cases, each drive can be connected to bus 403 via one or more data media interfaces. System memory 402 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0110] A program / utility 4025 having a set (at least one) of program modules 4024 may be stored, for example, in system memory 402, and such program modules 4024 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment. Program modules 4024 typically perform the functions and / or methods described in the embodiments of the present invention.
[0111] The computing device 40 can also communicate with one or more external devices 404 (such as a keyboard, pointing device, display, etc.). This communication can be performed via the input / output (I / O) interface 405. Furthermore, the computing device 40 can also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 406. Figure 4 As shown, network adapter 406 communicates with other modules of computing device 40 (such as processing unit 401) via bus 403. It should be understood that, although... Figure 4 As not shown, it can be used in conjunction with computing device 40 with other hardware and / or software modules.
[0112] The processing unit 401 executes various functional applications and data processing by running programs stored in the system memory 402. For example, it acquires multi-channel magnetocardiogram (MCG) or electrocardiogram (ECG) signals from the human heart and preprocesses the MCG or ECG signals; locates the R wave and extracts the RR interval sequence, where R refers to the peak point of each heartbeat in the ECG signal and RR refers to the time interval between two adjacent heartbeat peak points; performs topological data analysis on the RR interval sequence, generates a persistent graph through Lower-Star subset filtering and Vietoris-Rips complex calculation, and extracts the statistics of the topological feature points of the persistent graph as topological features; inputs the RR interval sequence and topological features into a two-branch deep learning model, and fuses them through temporal branch, topological branch, and fusion layer to generate a fusion vector, and classifies emotional states based on the fusion vector.
[0113] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0114] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interface; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0115] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0116] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0117] If the functionality is implemented as a software functional unit and sold or used as an independent product, it can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0118] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
[0119] Furthermore, although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0120] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for emotion classification of cardiac electromagnetic signals based on topological analysis of heart rate variability, characterized by: Comprising, Collecting multi-channel magnetocardiogram signals or electrocardiogram signals of a human heart, and preprocessing the magnetocardiogram signals or electrocardiogram signals; Positioning R waves and extracting RR interval sequences, wherein R refers to a peak point of each heartbeat in an electrocardio signal, and RR refers to a time interval between adjacent two heartbeat peak points; Performing topological data analysis on the RR interval sequences, generating a persistent diagram through Lower-Star sub-level set filtering and Vietoris-Rips complex calculation, and extracting statistics of topological feature points of the persistent diagram as topological features; Inputting the RR interval sequences and the topological features into a dual-branch deep learning model, performing fusion through a time sequence branch, a topological branch and a fusion layer, generating a fusion vector, and classifying emotional states based on the fusion vector.
2. The method of claim 1, wherein the method of emotion classification of cardiac electromagnetic signals based on topological analysis of heart rate variability is characterized by: The magnetocardiogram signals are collected by an optically pumped magnetometer array, the optically pumped magnetometer array includes 64 sensors to cover a 125*125 mm² area in an 8*8 layout, the collection by the optically pumped magnetometer array is performed in a multi-layer magnetic shielding barrel, the residual magnetism of the shielding environment magnetic field interference is less than 5 nT, the z-axis component of the magnetic field is recorded during the collection, and the sampling rate of the z-axis component of the magnetic field is greater than or equal to 250 Hz.
3. The method of claim 2, wherein the method of emotion classification of cardiac electromagnetic signals based on topological analysis of heart rate variability is characterized by: The preprocessing of the magnetocardiogram signals or electrocardiogram signals includes power frequency interference filtering, baseline correction and motion artifact elimination; Low-frequency noise, power frequency interference and motion artifacts are removed through high-pass filter and notch filter technologies; The removal of the low-frequency noise, the power frequency interference and the motion artifacts includes four-stage cascade filtering processing of noise components of the magnetocardiogram signals or electrocardiogram signals, separation of the motion artifacts based on a joint algorithm of independent component analysis (ICA) and empirical mode decomposition (EMD), the EMD refers to decomposition of residual noise into an intrinsic mode function, and the ICA refers to realization of decoupling of components of the magnetocardiogram signals or electrocardiogram signals through optimization of an objective function, and a specific calculation formula is as follows: ; wherein, represents an optimization objective function, W represents an unmixing matrix, n represents the number of signal channels, yi represents the output signal of the i-th channel after the matrix W transformation, represents the entropy of the i-th output signal yi, represents the determinant of the matrix W.
4. The method of claim 3, wherein the method of emotion classification of cardiac electromagnetic signals based on topological analysis of heart rate variability is characterized by: The positioning of the R waves and the extraction of the RR interval sequences include detection of the R waves by using an adaptive double-threshold method, generation of RR interval sequences and resampling to 4 Hz; The lower limit of the interval between adjacent two heartbeat peak points is 0.6 seconds, and the generated RR interval sequences are resampled to 4 Hz to form input data.
5. The method of claim 4, wherein the method of emotion classification of cardiac electromagnetic signals based on topological analysis of heart rate variability is characterized by: The topological data analysis includes: Takens embedding is performed on the RR interval sequences; 0-dimensional persistent diagrams are calculated through Lower-Star sub-level set filtering, and intermediate values and lifespans of points are extracted; 0-dimensional and 1-dimensional persistent diagrams are calculated through Vietoris-Rips complex calculation; 16-dimensional statistics are extracted from the persistent diagrams, including mean, standard deviation, skewness, kurtosis, percentile and entropy of M and L, and a 48-dimensional topological feature vector is constructed; The formula of the Takens embedding is as follows: ; where N is the sequence length, is the largest Lyapunov exponent.
6. The method of claim 5, wherein the method of emotion classification of cardiac electromagnetic signals based on topological analysis of heart rate variability is characterized by: L refers to calculation of a stability index of a birth and death time point pair (b, d), and M refers to a position parameter of the birth and death time point pair (b, d); The formula of the calculation of the stability index of the birth and death time point pair (b, d) is as follows: ; The formula of the position parameter of the birth and death time point pair (b, d) is as follows: ; Wherein, L is a continuous lifespan, b is a birth time, d is a death time, and M is a position parameter.
7. The method of claim 6, wherein the method of emotion classification of cardiac electromagnetic signals based on topological analysis of heart rate variability is characterized by: The dual-branch deep learning model comprises extracting time domain features from the RR interval sequence by one-dimensional deep separable convolution through a time sequence branch, processing persistent statistical features through a topology branch, aligning and fusing through a cross-attention mechanism, and generating a formula for the gated residual connection by a fully connected layer: ; wherein, is a comprehensive feature vector after gating fusion, is a gating value, is an attention mechanism output feature, is a timing feature, is a reverse gating value; Five-fold cross-validation is adopted, data augmentation is performed by adding Gaussian noise, time warping and amplitude scaling, a compound loss function composed of label smoothing cross entropy and adaptive Focal Loss weighting is designed, the Focal Loss is a loss function, the loss function comprises an adjustment factor gamma, the gamma satisfies a formula: ; Wherein, gamma is an adjustment factor; The fusion through the time sequence branch, the topology branch and the fusion layer comprises processing the fusion features by a dual-branch neural network architecture, the time sequence branch adopts one-dimensional deep separable convolution, the convolution kernel size is configured in an increasing sequence of 3 / 5 / 7 / 9, multi-scale rhythm patterns are captured, the topology branch encodes 48-dimensional topology data analysis features through a fully connected layer, and an attention weight matrix is calculated according to the information of the fusion features: ; where M is a mask to suppress redundant feature channels, is the attention weight output, Q is the query, K is the key, is the dot product matrix of the query and the key, is the dimension of the key, and softmax is a normalization function.
8. A system for emotion classification of heart electromagnetic signals based on topological analysis of heart rate variability, based on the method for emotion classification of heart electromagnetic signals based on topological analysis of heart rate variability according to any one of claims 1 to 7, characterized in that: Including, A signal acquisition module for acquiring MCG signals according to a sensor array and a magnetic shielding device; A preprocessing module for performing power frequency filtering and baseline correction; A feature extraction module for performing topology feature generation; A dual-branch classification module comprising a time sequence encoder, a topology encoder and a cross-attention fusion unit; An output module for generating emotion classification results and a visual report. 9.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is characterized in that: The processor executes the computer program to realize the steps of the emotion classification method of the heart electromagnetic signal based on topology analysis of heart rate variability according to any one of claims 1-7.
10. A computer readable storage medium having stored thereon a computer program, characterized in that: The computer program is executed by the processor to realize the steps of the emotion classification method of the heart electromagnetic signal based on topology analysis of heart rate variability according to any one of claims 1-7.
Citation Information
Cited By
Sudden arrhythmia death risk prediction method and device, storage medium and equipment
CN121910348A
