Heartbeat signal identity recognition method and system based on knowledge distillation, storage medium and electronic device

By adopting the knowledge distillation framework in heartbeat signal identity recognition and using ResNet to guide ViT model training, the problem of low accuracy in heartbeat signal identity recognition is solved, and the accuracy and efficiency of identity recognition are improved.

CN119961909BActive Publication Date: 2025-10-14HANGZHOU DIANZI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510049408.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-10-14
Estimated Expiration
2045-01-13

AI Technical Summary

Technical Problem

The existing identity recognition method based on heartbeat signals has low accuracy due to factors such as millimeter-wave radar sampling rate and sampling time, and has not yet met the requirements of practical application.

Method used

A knowledge distillation-based method is adopted, and the pre-trained ResNet model is used as the teacher model to guide the training of the ViT student model. Through data preprocessing, training and testing stages, the accuracy of the model is improved by combining log-mel spectrograms and multi-head self-attention mechanism.

Benefits of technology

The accuracy of heartbeat signal identification is improved, the overfitting problem is overcome, and a more efficient identification effect is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119961909B_ABST
    Figure CN119961909B_ABST
Patent Text Reader

Abstract

The application discloses a heartbeat signal identity recognition method and system based on knowledge distillation, a storage medium and an electronic device. The method comprises the following steps: 1) data preprocessing stage: the heartbeat signal collected by the millimeter wave radar is segmented, each segment of the heartbeat signal is subjected to frequency domain analysis to obtain a log-mel spectrum diagram, and the obtained log-mel spectrum diagram set is divided into a training set and a test set. 2) training stage: a knowledge distillation model is constructed based on a residual network ResNet and a ViT, ResNet is used as a teacher model to guide the training of a ViT student model, and then the training of the knowledge distillation model is completed based on the training set; 3) test stage: the knowledge distillation model obtained by training in step 2) is used to test the test set, and a heartbeat signal identity recognition result is obtained. The application overcomes the overfitting problem caused by a too small data set, and improves the accuracy of identity recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of physiological signal processing, and specifically relates to a heartbeat signal identity recognition method and system based on knowledge distillation, a storage medium and an electronic device. The present invention is a technical solution for identity recognition through heartbeat signals collected by millimeter wave radar. Background Art

[0002] Heartbeat signals are an important physiological signal in the human body, and heartbeat-based identity recognition technology has broad application prospects. Traditional identity recognition methods, such as facial recognition and fingerprint recognition, have significant drawbacks. Facial recognition faces privacy issues and high false positive rates, primarily due to unconsented facial data collection, potential data misuse and leakage, poor image quality, poor lighting conditions, and susceptibility to interference from obstructions. Fingerprint recognition requires physical contact, making fingerprints susceptible to wear, damage, or contamination, and also poses the risk of being copied. Consequently, heartbeat-based identity recognition methods have gained increasing attention in recent years. This method, which analyzes the characteristics of different individuals' heartbeat signals to achieve identity recognition, offers advantages such as high security, anti-forgery, and anti-interference capabilities. However, current heartbeat-based identity recognition methods suffer from low accuracy in practical applications due to factors such as millimeter-wave radar sampling rate and sampling duration, and further improvement is needed. Therefore, the search for more accurate and efficient heartbeat-based identity recognition methods is a current research hotspot. Summary of the Invention

[0003] In response to the above-mentioned problems existing in the prior art, the present invention provides a heartbeat signal identity recognition method and system based on knowledge distillation, a storage medium and an electronic device.

[0004] The present invention adopts the following technical solutions:

[0005] The heartbeat signal identification method based on knowledge distillation includes data preprocessing, training, and testing. The specific steps are as follows:

[0006] 1) Data preprocessing: The heartbeat signals collected by the millimeter-wave radar are segmented and analyzed in the frequency domain to obtain a log-mel (log-mel) spectrogram for each segment. The resulting log-mel spectrogram set is then divided into a training set and a test set.

[0007] 2) Training phase: First, a knowledge distillation model is built based on ResNet (residual network) and (Vision Transformer, ViT). ResNet is used as the teacher model to guide the training of the ViT student model, and then the model training is completed based on the training set.

[0008] 3) Testing phase: Use the model trained in step 2) to perform model performance testing based on the test set to obtain the accuracy on the test set.

[0009] This paper adopts a knowledge distillation framework to solve the overfitting problem of the model. Specifically, ResNet is used as a teacher model to guide the training of the student model ViT, thereby greatly reducing ViT's dependence on large-scale data.

[0010] Preferably, in the data preprocessing stage, the heartbeat signal collected by the millimeter wave radar is processed in segments according to the length of each time window being 2 seconds and the overlap ratio of adjacent time windows being 50%. Each segment of the heartbeat signal is subjected to frequency domain analysis to obtain a log-mel (logarithmic mel) spectrogram, and a set of log-mel spectrograms is obtained, which is then divided into a training set and a test set.

[0011] Preferably, the data preprocessing stage is specifically as follows:

[0012] Step 1.1) Segment the heartbeat signal as follows: To enhance the contextual relevance between adjacent signals, overlap the time windows so that adjacent time windows share a portion of the data. The time window length and overlap ratio are set to 2s and 50%, respectively.

[0013] Step 1.2) De-noise the heartbeat signal, as follows: pass each segment of the heartbeat signal through the bandwidth range

[0014] A bandpass filter of [0.75, 2.5] Hz is used to filter out noise and retain frequency components directly related to cardiac activity. Subsequently, a Hamming window is used to eliminate spectral leakage caused by truncation. The Hamming window has a narrow main lobe and strong side lobe suppression function, which reduces the influence of side lobes in the frequency domain. As shown in Equation (1):

[0015]

[0016] In formula (1), w(q) is the Hamming window function, N is the length of the window, and q is the sample index within the window.

[0017] Step 1.3) Frequency domain analysis of the heartbeat signal is as follows: Map the original frequency of the heartbeat signal to the mel scale. The mapping process is shown in equations (2) and (3):

[0018]

[0019] f=700(10 m / 2595 -1) (3)

[0020] In formulas (2) and (3), f represents a specific frequency value, and m represents the mel scale.

[0021] Then a set of triangle filters is used to create the mel filter, as shown in equation (4):

[0022]

[0023] Among them, f m-1 ,f m , and f m+1 are three adjacent mel frequency points, which are used to define the boundaries of each triangular filter. The STFT (short-time Fourier transform) spectrum is multiplied by the mel filter to obtain the mel spectrum, as shown in formula (5):

[0024] MS(x,f)=Spectrogram(x)⊙B m (f) (5)

[0025] Where x represents the heartbeat signal, Spectrogram(x) represents the STFT spectrum, and B m (f) represents the mel filter, and ⊙ represents the product operation.

[0026] Furthermore, the spectrum graph needs to be converted into dB units by using logarithmic operations to enhance the low-frequency components, as shown in formula (6):

[0027] logMelSpec=10*log 10 (MS(x, f))-10*log 10 (ref) (6)

[0028] Where LogMelSpec is the log-mel spectrum, ref is the reference value, which is set to 1, and the amplitude MS(x, f) is scaled relative to ref.

[0029] Preferably, during the training phase:

[0030] Step 2.1) First, establish the teacher model network.

[0031] ResNet was chosen as the base architecture, with log-mel spectrograms as input. The specific steps are as follows: First, the log-mel spectrograms obtained in step 1.3) are used as input to the network, with an initial dimension of (3, 64, 64), where 3 represents the number of color channels and 64x64 represents the spatial dimensions of the image. Next, the input image passes through a 7x7 convolutional layer with 64 output channels and a stride of 2 to extract primary features. This step transforms the input dimensions from (3, 64, 64) to (64, 32, 32). These feature maps then pass through a 3x3 max pooling layer, also with a stride of 2, further reducing the spatial dimensions to (64, 16, 16), thereby reducing computational effort and preventing overfitting. The data then passes through four residual block groups, each consisting of two 3x3 convolutional layers with batch normalization and ReLU activation. The first residual block group maintains the input and output dimensions unchanged, with both input and output being (64, 16, 16). The first convolutional layer in the second residual block group uses stride 2, resulting in an output dimension of (128, 8, 8). The first convolutional layer in the third residual block group uses stride 2, further reducing the output dimension to (256, 4, 4). The first convolutional layer in the fourth residual block group also uses stride 2, resulting in an output dimension of (512, 2, 2). After all residual blocks, the feature map passes through a global average pooling layer, which averages the data for each channel to produce a 512-dimensional one-dimensional vector of size (512). This process not only reduces the number of parameters but also preserves the average information for each channel, helping to improve the model's generalization ability. Finally, this one-dimensional feature vector is passed to a fully connected layer, which maps the features to the specified number of categories to complete the classification task. The number of output nodes in the fully connected layer equals the number of categories, with each node representing the predicted score for a category.

[0032] Step 2.2) Further establish the student model network.

[0033] First, we use the ViT model pre-trained on the ImageNet dataset as the student model. ViT's powerful feature extraction capability is attributed to the multi-head self-attention mechanism (MHSA). We use the Vanilla ViT Transformer (basic ViT transformer), which includes multiple cascaded encoder layers, to enable the student model to fully capture the relationship between time and frequency in the log-mel spectrogram. seq ∈R n×d Represents the embedding matrix of the entire input sequence, where n is the number of tokens and d is the embedding dimension of each token. seq Linear transformation into query key Sum d k d v Represent the query (key) and value dimensions respectively. Then Q, K and V are divided into h heads. For the i-th head, SA i The (self-attention) formula is shown in formula (7):

[0034]

[0035] Among them, Q, K and V are respectively obtained by linear transformation from the input sequence x seq The resulting query, key, and value matrix, Q i , K i and V i The sub-matrices after these matrices are split in the multi-head mechanism correspond to the query, key, and value of the i-th head respectively. The self-attention in each head runs in parallel, and the outputs of multiple heads are connected, that is, the self-attention outputs of multiple heads are SA1, SA2, ..., SA i ,…,SA h The matrix is ​​concatenated along the feature dimension to form an n×d matrix. The next step is to apply a linear transformation to the concatenated matrix (i.e., multiply it with a learnable weight matrix) to map the output back to the original feature dimension. In order to better utilize the position information in the sequence, in the multi-head self-attention mechanism (MHSA), the original input is mapped to a vector representation of a fixed dimension, called a token. Each token not only contains the local feature information of the input data, but also reflects its position in the sequence by introducing relative position encoding or absolute position encoding. Although both encoding methods can help the model understand the position of the token, the absolute position encoding is static, while the relative position encoding is more flexible because it depends on the relative distance between tokens and can be adjusted through a learnable parameter matrix (such as the bias B i ) to more accurately capture the relative position relationship between tokens. Deviation B i ∈R n×n Introduced in each self-attention head, the modified self-attention definition is shown in formula (8):

[0036]

[0037] Furthermore, the absolute position pos=(pos i ,…,pos n ), add these positional encodings to the input token embedding vector, as shown in formula (9):

[0038]

[0039] in, Indicates assignment, i is the position index, indicating the i-th token in the sequence, x i Represents x seq The embedding vector of the i-th token in , pos i represents the encoding of the i-th position, and the encoding method is shown in formula (10):

[0040]

[0041] Among them, j is the dimension index of the embedding vector, pos i,2j The calculation is the value of the even index position in the position embedding vector, pos i,2j+1 The values ​​of the odd-indexed positions in the position embedding vector are calculated.

[0042] Step 2.3) Further, the accuracy of the student model is improved by using the knowledge distillation method. The distillation method uses Logits (unnormalized predicted values) distillation to train the student model by minimizing the difference between the teacher model and the student model in Logits. Since identity recognition based on heartbeat signals is a multi-classification task, the soft target calculated by the temperature-scaled softmax function is used to guide the student model training. Specifically, the soft target is the probability distribution of a specific category, and this process is implemented by softmax, as shown in Equation (11):

[0043]

[0044] Among them, p i Indicates the probability that the test result is the i-th category, z i is the logits of the teacher model for the i-th class, T is the temperature parameter used to control the influence of each class, and C is the number of classes. Then, the distillation loss function shown in formula (12) is used to characterize the difference between the output of the student model and the teacher model:

[0045] L ResD (p(z t ,T),p(z s ,T))=KL(p(z t ,T),p(z s ,T)) (12)

[0046] Among them, L ResD represents the residual loss, which is used to measure the difference between the teacher model and the student model, KL represents the Kullback-Leibler divergence loss function, and p(z t ,T) represents the probability distribution of the output of the teacher model after temperature scaling, p(z s ,T) represents the probability distribution of the output of the student model after temperature scaling, zt is the Logits of the teacher model, z s are the Logits of the student model.

[0047] The student loss function adopts the cross entropy loss function as shown in formula (13):

[0048]

[0049] Among them, y refers to the true label, y i and p(z s ,T=1) i are the i-th element in the true label and predicted probability distribution, respectively. p represents the soft target of the student model, which enables the student model to learn the correct classification of the data. In this paper, the soft target is obtained by pre-training ResNet and ViT, and then the student model learns deep knowledge from the teacher model through distillation loss. At the same time, the cross entropy loss function learns intrinsic features from the true label. Finally, the hybrid loss function obtained by combining the distillation loss function and the cross entropy loss function is shown in Equation (14):

[0050] L Global =(1-λ)·L ResD (p(z t ,T),p(z s ,T))+λ·L CE (y,p(z s ,T=1)) (14)

[0051] Here, λ is the weight used to balance the two losses.

[0052] Step 2.4) Training the model is as follows: First, a knowledge distillation model is constructed based on ResNet and ViT. A pre-trained ResNet is used as the teacher model to guide the training of the ViT student model. The ViT student model is trained using data from the training set using the adaptive moment estimation optimizer Adam (with an initial learning rate of 1e-3, a size of 8, and a weight decay of 0.2). Throughout the training process, the ResNet teacher model does not participate in parameter updates; its intrinsic features are only used for inference and soft target generation. The ViT student model gradually optimizes its performance through backpropagation and parameter updates, ultimately maintaining high accuracy while inheriting the ResNet knowledge.

[0053] Preferably, in the testing phase, the trained knowledge distillation model is used to perform a model performance test based on the test set, and the steps are as follows:

[0054] In step 3.1), use an independent test dataset that is different from the training and validation datasets.

[0055] Step 3.2) Load the teacher model and its weights, and then load the student model and its weights obtained after knowledge distillation training.

[0056] Step 3.3) Call the evaluation method of the student model and input the test set data into the student model that has been trained through knowledge distillation for evaluation.

[0057] Step 3.4) Calculate the accuracy by initializing two counters: correct, which records the number of correctly predicted examples, and total, which records the total number of examples. Next, iterate over each example in the test set, using the knowledge distillation model to predict and obtain the predicted label. If the predicted label is the same as the true label, increment the correct counter by 1. Regardless of whether the prediction is correct or not, increment the total counter by 1. Finally, calculate the accuracy by dividing correct by total: Accuracy = correct / total. This result is the model's accuracy on the test set.

[0058] The present invention also discloses a heartbeat signal identification system based on knowledge distillation, which is used to execute the above method and includes the following units:

[0059] Data preprocessing unit: The millimeter-wave radar collects heartbeat signals and performs segmented processing. Each segment of the heartbeat signal is analyzed in the frequency domain to obtain a log-mel spectrum graph. The resulting log-mel spectrum graph set is divided into a training set and a test set.

[0060] Training unit: First, build a knowledge distillation model based on ResNet and ViT, and then complete the model training based on the training set;

[0061] Testing unit: Use the trained knowledge distillation model to test the test set and calculate the accuracy based on the true labels corresponding to the heartbeat signals.

[0062] A storage medium stores computer instructions, wherein the computer instructions are used to cause a computer to execute the above method or system.

[0063] An electronic device, comprising:

[0064] processor;

[0065] The memory is used to store a program. When the program is called and executed by the processor, the processor executes the above method or system.

[0066] The beneficial effects of the present invention are as follows:

[0067] This paper proposes a heartbeat signal identity recognition method and system based on knowledge distillation. In this knowledge distillation framework, a pretrained ResNet model serves as a teacher model, effectively guiding the training of the student model (ViT), thereby overcoming the overfitting problem caused by small data sets. This is the first application of knowledge distillation to address overfitting in the field of heartbeat-based identity recognition. This invention improves the accuracy of identity recognition using heartbeat signals. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following will introduce the drawings required for use in the embodiments or the description of the prior art:

[0069] Figure 1 Schematic diagram of the heartbeat signal preprocessing process in a preferred embodiment of the present invention.

[0070] Figure 2 Schematic diagram of the knowledge distillation framework structure of a preferred embodiment of the present invention.

[0071] Figure 3 The figure is a flow chart of a heartbeat signal identification method based on knowledge distillation according to a preferred embodiment of the present invention.

[0072] Figure 4 This is a block diagram of a heartbeat signal identification system based on knowledge distillation in a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0073] The present invention is described in detail below with reference to the embodiments and accompanying drawings so that those skilled in the art can better understand the present invention.

[0074] like Figure 1-3 As shown, this embodiment provides a heartbeat signal identity recognition method based on knowledge distillation, including a data preprocessing stage, a training stage, and a testing stage. The specific steps are described as follows.

[0075] 1) Data preprocessing: The heartbeat signal collected by the millimeter-wave radar is segmented and analyzed in the frequency domain to obtain a log-mel spectrum of each segment. The log-mel spectrum is then divided into a training set and a test set. The details are as follows:

[0076] Step 1.1) Segment the heartbeat signal as follows: To enhance the contextual relevance between adjacent signals, overlap the time windows so that adjacent time windows share a portion of data. In this embodiment, the time window length and overlap ratio are set to 2s and 50% respectively.

[0077] Step 1.2) Heartbeat signal denoising is as follows: Each segment of the heartbeat signal is passed through a bandpass filter with a bandwidth of [0.75, 2.5] Hz to filter out noise and retain frequency components directly related to cardiac activity. Subsequently, a Hamming window is used to eliminate spectral leakage caused by truncation. The Hamming window has a narrow main lobe and strong side lobe suppression function, reducing the influence of side lobes in the frequency domain. Equation (1) is as follows:

[0078]

[0079] In formula (1), N is the length of the window and q is the sample index in the window.

[0080] Step 1.3) Frequency domain analysis of the heartbeat signal is as follows: Map the original frequency of the heartbeat signal to the mel scale. The mapping process is shown in equations (2) and (3):

[0081]

[0082] f=700(10 m / 2595 -1)(3)

[0083] In formulas (2) and (3), f represents a specific frequency value, and m represents the mel scale.

[0084] Due to the logarithmic transformation, the change of the mel scale m tends to be gentle when f is large. Then a set of triangular filters is used to create the mel filter, as shown in formula (4):

[0085]

[0086] Among them, f m-1 , f m , and f m+1 are three adjacent mel frequency points, which are used to define the boundaries of each triangular filter. The STFT (short-time Fourier transform) spectrum is multiplied by the mel filter to obtain the mel spectrum, as shown in formula (5):

[0087] MS(x,f)=Spectrogram(x)⊙B m (f) (5)

[0088] Where x represents the heartbeat signal, Spectrogram(x) represents the STFT spectrum, and B m (f) represents the mel filter, and ⊙ represents the product operation.

[0089] The spectrum graph needs to be converted to dB units by using logarithmic operations to enhance the low-frequency components, as shown in equation (6):

[0090] LogMelSpec=10*log10 (MS(x, f))-10*log 10 (ref) (6)

[0091] Where LogMelSpec is the log-mel spectrum, ref is the reference value, which is set to 1, and the amplitude MS(x, f) is scaled relative to ref.

[0092] 2) In the training phase, a knowledge distillation model is constructed based on the residual network ResNet and ViT. ResNet is used as the teacher model to guide the training of the ViT student model, and then the knowledge distillation model training is completed based on the training set. The details are as follows:

[0093] Step 2.1) First, establish the teacher model network.

[0094] This example uses ResNet as the base architecture, with log-mel spectrograms as input. The specific steps are as follows: First, the log-mel spectrogram obtained in step 1.3) is used as the network input, with an initial dimension of (3, 64, 64), where 3 represents the number of color channels and 64x64 represents the spatial size of the image. Next, the input image passes through a 7x7 convolutional layer with 64 output channels and a stride of 2 to extract primary features. This step converts the input dimensions from (3, 64, 64) to (64, 32, 32). These feature maps then pass through a 3x3 max pooling layer, also with a stride of 2, further reducing the spatial dimensions to (64, 16, 16), thereby reducing computational effort and preventing overfitting. The data then passes through four residual block groups, each consisting of two 3x3 convolutional layers with batch normalization and ReLU activation functions. The first residual block group maintains the input and output dimensions unchanged, with both input and output being (64, 16, 16). The first convolutional layer in the second residual block group uses stride 2, resulting in an output dimension of (128, 8, 8). The first convolutional layer in the third residual block group uses stride 2, further reducing the output dimension to (256, 4, 4). The first convolutional layer in the fourth residual block group also uses stride 2, resulting in an output dimension of (512, 2, 2). After all residual blocks, the feature map passes through a global average pooling layer, which averages the data of each channel to generate a 512-dimensional one-dimensional vector with a size of (512). This process not only reduces the number of parameters but also retains the average information of each channel, helping to improve the generalization ability of the model. Finally, this one-dimensional feature vector is passed to a fully connected layer, which maps the features to the specified number of categories to complete the classification task. The number of output nodes of the fully connected layer is equal to the number of categories, and each node represents the prediction score of a category.

[0095] Step 2.2) Further establish the student model network.

[0096] The pre-trained ViT model obtained using the ImageNet dataset is first used as the student model. The powerful feature extraction capability of ViT is attributed to the multi-head self-attention mechanism (MHSA), which uses a Vanilla ViT Transformer containing multiple cascaded encoder layers, which can enable the student model to fully capture the temporal and frequency relationship in the log-mel spectrogram.x seq ∈R n×d represents the embedding matrix of the entire input sequence, where n is the number of tokens and d is the embedding dimension of each token. The input x seq is linearly transformed into queries keys and values d k , d v represent the dimensions of the queries (keys) and values, respectively. Then Q, K and V are divided into h heads, for the i-th head, SA i The (self-attention) formula is shown in equation (7):

[0097]

[0098] where Q, K and V are the query, key and value matrices generated by linear transformation from the input sequence x seq Q i , K i and V i are the sub-matrices of these matrices after being divided in the multi-head mechanism, corresponding to the query, key and value of the i-th head, respectively. The self-attention in each head runs in parallel, and the outputs of multiple heads are concatenated, i.e. the self-attention outputs SA1, SA2, …, SA i , …, SA h are concatenated along the feature dimension to form an nxd matrix, and a linear transformation (i.e. multiplication by a learnable weight matrix) is applied to the concatenated matrix in the next step to map the output back to the original feature dimension. In order to better utilize the position information in the sequence, in the multi-head self-attention mechanism (MHSA), the original input is mapped to a fixed-dimensional vector representation, called token. Each token not only contains local feature information of the input data, but also reflects its position in the sequence by introducing relative position encoding or absolute position encoding. Although both of these two encoding methods can help the model understand the position of the token, the absolute position encoding is static, while the relative position encoding is more flexible because it depends on the relative distance between tokens and can be parameterized by a learnable parameter matrix (such as the bias B i) is adjusted to capture the relative positional relationship between tokens more accurately. Bias B i ∈R n×n In each self-attention head, the modified self-attention definition is shown in equation (8):

[0099]

[0100] In addition, the absolute positions pos = (pos i ,…,pos n ) are encoded using sine and cosine functions, and these position encodings are added to the input token embedding vectors, as shown in equation (9):

[0101]

[0102] where, is the assignment operation, i is the position index, x i represents the embedding vector of the i-th token in x seq , and pos i represents the encoding of the i-th position, which is encoded as shown in equation (10):

[0103]

[0104] where j is the dimension index of the embedding vector, pos i,2j is the value of the even-indexed position in the position embedding vector, and pos i,2j+1 is the value of the odd-indexed position in the position embedding vector.

[0105] Step 2.3), further, the method of knowledge distillation is used to improve the accuracy of the student model. Among them, the distillation method uses Logits (unnormalized prediction values) distillation, by minimizing the difference between the teacher model and the student model in Logits, to train the student model. Since the identity recognition based on heart rate signals is a multi-classification task, the soft target calculated by the temperature scaled softmax function is used to guide the training of the student model. Specifically, the soft target is the probability distribution of a certain class, and this process is realized by softmax, as shown in equation (11):

[0106]

[0107] where p i represents the probability that the test result is the i-th class, and z iis the Logits of the teacher model for the i-th class, T is a temperature parameter used to control the influence of each class, and C is the number of classes. Then, the difference between the outputs of the student model and the teacher model is characterized by a distillation loss function shown in equation (12):

[0108] L ResD (p(z t ,T),p(z s ,T))=KL(p(z t ,T),p(z s ,T)) (12)

[0109] where L ResD represents the residual loss used to measure the difference between the teacher model and the student model, and KL represents the Kullback-Leibler divergence loss function. p(z t ,T) represents the probability distribution obtained by temperature scaling the output of the teacher model, and p(z s ,T) represents the probability distribution obtained by temperature scaling the output of the student model. z t is the Logits of the teacher model, and z s is the Logits of the student model.

[0110] The student loss function uses a cross-entropy loss function as shown in equation (13):

[0111]

[0112] where y represents the true label, y i and p(z s ,T=1) i are the i-th elements in the true label and the predicted probability distribution, respectively. p represents the soft target of the student model, enabling the student model to learn the correct classification of the data. In the present application, the soft target is obtained through the pre-trained ResNet and ViT, and then the student model learns deep knowledge from the teacher model through the distillation loss, while the cross-entropy loss function learns the intrinsic features from the true label. Finally, the hybrid loss function obtained by combining the distillation loss function and the cross-entropy loss function is shown in equation (14):

[0113] L Global =(1-λ)·L ResD (p(z t ,T),p(z s ,T))+λ·L cE (y,p(z s ,T=1)) (14)

[0114] where λ is the weight used to balance the two losses.

[0115] Step 2.4) Training the model is as follows:

[0116] First, a knowledge distillation model was constructed based on ResNet and ViT. A pretrained ResNet was used as the teacher model to guide the training of the ViT student model. The ViT student model was trained using data from the training set using the adaptive moment estimation optimizer Adam (with an initial learning rate of 1e-3, a size of 8, and a weight decay of 0.2). Throughout the training process, the ResNet teacher model does not participate in parameter updates; its intrinsic features are only used for inference and soft target generation. The ViT student model gradually optimizes its performance through backpropagation and parameter updates, ultimately maintaining high accuracy while inheriting the ResNet knowledge.

[0117] 3) Testing phase: Use the trained knowledge distillation model to test the model performance based on the test set. The steps are as follows:

[0118] Step 3.1) Use an independent test dataset, ensuring that it is different from the training and validation datasets.

[0119] Step 3.2) Load the teacher model and its weights, and then load the student model and its weights obtained after knowledge distillation training.

[0120] Step 3.3) Call the evaluation method of the student model and input the test set data into the student model that has been trained through knowledge distillation for evaluation.

[0121] Step 3.4) Calculate the accuracy by initializing two counters: correct, which records the number of correctly predicted examples, and total, which records the total number of examples. Next, iterate over each example in the test set, using the knowledge distillation model to predict and obtain the predicted label. If the predicted label is the same as the true label, increment the correct counter by 1. Regardless of whether the prediction is correct or not, increment the total counter by 1. Finally, calculate the accuracy by dividing correct by total: Accuracy = correct / total. This result is the model's accuracy on the test set.

[0122] like Figure 4 As shown, this embodiment discloses a heartbeat signal identity recognition system based on knowledge distillation, which is used to execute the method of the above embodiment, and includes the following units:

[0123] The data preprocessing unit: the millimeter wave radar collects a heartbeat signal, segments the complete heartbeat signal according to the length of each time window of 2s and the overlapping ratio of adjacent time windows of 50%, obtains a log-mel spectrum diagram through frequency domain analysis for each segment of the heartbeat signal, obtains a log-mel spectrum diagram set, and divides the set into a training set and a test set.

[0124] The training unit: a knowledge distillation model is constructed based on ResNet and ViT, and model training is completed based on the training set.

[0125] The test unit: the knowledge distillation model obtained through training is used to test the test set, and the accuracy is calculated in combination with the real label corresponding to the heartbeat signal.

[0126] Other contents of the embodiment can refer to the above method embodiment.

[0127] A storage medium stores computer instructions for causing a computer to execute the method or system according to the above embodiment.

[0128] An electronic device includes:

[0129] A processor;

[0130] A memory is configured to store a program, and when the program is invoked and executed by the processor, the processor is caused to execute the method or system of the above embodiment.

[0131] The specific embodiments described herein are merely illustrative of the spirit of the present application. Those skilled in the art of the present application can make various modifications or supplements to the described specific embodiments or replace them with similar ways, but will not deviate from the spirit of the present application or exceed the scope defined by the appended claims.

Claims

1. A heartbeat signal identification method based on knowledge distillation is characterized by: The steps include: 1) Data preprocessing: The heartbeat signals collected by the millimeter-wave radar are segmented and analyzed in the frequency domain to obtain a log-mel spectrogram for each segment. The log-mel spectrogram set is then divided into a training set and a test set. 2) Training phase: A knowledge distillation model is constructed based on the residual network ResNet and ViT. ResNet is used as the teacher model to guide the training of the ViT student model. The knowledge distillation model is then trained based on the training set. 3) Testing phase: Use the knowledge distillation model trained in step 2) to perform model performance testing based on the test set to obtain the heartbeat signal identity recognition result.

2. The heartbeat signal identity recognition method based on knowledge distillation according to claim 1, characterized in that: Step 1), during the data preprocessing phase: Step 1.1) Segment the heartbeat signal as follows: set the time window length and overlap ratio to 2s and 50% respectively; Step 1.2) Heartbeat signal denoising is as follows: each segment of the heartbeat signal is passed through a bandpass filter with a bandwidth range of [0.75, 2.5] Hz to filter out noise; a Hamming window is used to eliminate spectral leakage caused by truncation, as shown in formula (1): In formula (1), w(q) is the Hamming window function, N is the length of the window, and q is the sample index within the window; Step 1.3) Frequency domain analysis of the heartbeat signal is as follows: Map the original frequency of the heartbeat signal to the Mel scale. The mapping process is shown in equations (2) and (3): f=700(10 m / 2595 -1)(3) In formulas (2) and (3), f represents a specific frequency value, and m represents the mel scale.

3. The heartbeat signal identity recognition method based on knowledge distillation as claimed in claim 2, characterized in that: In step 1.3), a set of triangle filters is used to create the mel filter, as shown in formula (4): Among them, f m-1 、f m and f m+1 are three adjacent mel frequency points, which are used to define the boundary of each triangular filter. The short-time Fourier transform (STFT) spectrum is multiplied by the mel filter to obtain the mel spectrum, as shown in formula (5): MS(x,f)=Spectrogram(x)⊙B m (f) (5) Where x represents the heartbeat signal, Spectrogram(x) represents the STFT spectrum, and B m (f) represents the mel filter, and ⊙ represents the product operation.

4. The heartbeat signal identification method based on knowledge distillation as claimed in claim 3 is characterized in that the steps 1.3), the spectrum is converted to dB units using logarithmic operation, as shown in formula (6): LogMelSpec=10*log 10 (MS(x,f))-10*log 10 (ref) (6) Where LogMelSpec is the log-mel spectrum, ref is the reference value, and MS(x, f) is the amplitude.

5. The heartbeat signal identity recognition method based on knowledge distillation according to any one of claims 1 to 4, characterized in that: Step 2), during the training phase: Step 2.1) Establish a teacher model; First, the log-mel spectrogram obtained in step 1.3) is used as input with an initial dimension of (3, 64, 64), where 3 represents the number of color channels and 64x64 is the spatial dimension of the image. Next, the input spectrogram passes through a 7x7 convolutional layer with 64 output channels and a stride of 2, thereby converting the input dimension from (3, 64, 64) to (64, 32, 32). Subsequently, the feature map passes through a 3x3 maximum pooling layer with a stride of 2 to reduce the spatial dimension to (64, 16, 16). Then, it passes through four residual block groups, each of which contains two 3x3 convolutional layers with batch normalization and ReLU activation functions. The first residual block group keeps the input and output dimensions unchanged, that is, both the input and output are (6 4,16,16); the first convolution layer in the second residual block group uses stride 2, so that the output dimension becomes (128,8,8); the first convolution layer in the third residual block group uses stride 2, reducing the output dimension to (256,4,4); the first convolution layer in the fourth residual block group uses stride 2, and the final output dimension is (512,2,2); after all residual blocks, the feature map passes through the global average pooling layer to average the data of each channel to generate a 512-dimensional one-dimensional vector with a size of (512); finally, the one-dimensional vector is passed to the fully connected layer, which maps the features to the specified number of categories to complete the classification task; the number of output nodes of the fully connected layer is equal to the number of categories, and each node represents the prediction score of a category; Step 2.2), establish student model; Use the ViT model obtained by pre-training the public dataset ImageNet dataset as the student model; seq ∈R n×d Represents the embedding matrix of the entire input sequence, where R is a set of real numbers, n is the number of tokens, and d is the embedding dimension of each token; the input x of the multi-head attention mechanism seq Linear transformation into query key Sum d k d v Represent the dimensions of query and value respectively; then Q, K and V are divided into h heads, and for the i-th head, self-attention SA i The formula is shown in formula (7): Among them, Q, K and V are respectively obtained by linear transformation from the input sequence x seq The resulting query, key, and value matrix, Q i , K i and V i They are the sub-matrices after the corresponding matrix is ​​split in the multi-head mechanism, corresponding to the query, key and value of the i-th head respectively; the self-attention in each head runs in parallel, and the self-attention outputs of multiple heads are SA1, SA2, ..., SA i ,…,SA h The n×d matrix is ​​concatenated along the feature dimension, and a linear transformation is applied to the concatenated matrix to map the output back to the original feature dimension. In the multi-head self-attention mechanism, the original input is mapped to a vector representation of a fixed dimension, called a token, and the bias B i ∈R n×n Introduced in each self-attention head, the modified self-attention definition is shown in formula (8): Encode the absolute position pos using sine and cosine functions = (pos i ,…,pos n ), add the positional encoding to the input token embedding vector, as shown in formula (9): in, Indicates assignment, i is the position index, indicating the i-th token in the sequence, x i Represents x seq The embedding vector of the i-th token in , pos i represents the encoding of the i-th position, and the encoding method is shown in formula (10): Among them, j is the dimension index of the embedding vector, pos i,2j is the value of the even-indexed position in the position embedding vector, pos i,2j+1 is the value of the odd-indexed position in the position embedding vector; Step 2.3) Use knowledge distillation to improve the accuracy of the student model; The knowledge distillation method uses unnormalized predicted value Logits distillation to train the student model by minimizing the difference between the teacher model and the student model on Logits. The soft target is the probability distribution of a specific category. This process is shown in Equation (11): Among them, p i Indicates the probability that the test result is the i-th category, z i is the logits of the teacher model for the i-th category, T is the temperature parameter used to control the influence of each category, and C is the number of categories. The difference between the output of the student model and the teacher model is characterized by the distillation loss function shown in formula (12): L ResD (p(z t ,T),p(z s ,T))=KL(p(z t ,T),p(z s ,T)) (12) Among them, L ResD represents the residual loss, which is used to measure the difference between the teacher model and the student model, KL represents the Kullback-Leibler divergence loss function, and p(z t ,T) represents the probability distribution of the output of the teacher model after temperature scaling, p(z s ,T) represents the probability distribution of the output of the student model after temperature scaling, z t is the Logits of the teacher model, z s are the Logits of the student model; The student loss function adopts the cross entropy loss function as shown in formula (13): Among them, y refers to the true label, y i and p(z s ,T=1) i are the i-th element in the true label and predicted probability distribution respectively; p represents the soft target of the student model, which enables the student model to learn the correct classification of the data; the soft target is obtained by pre-training ResNet and ViT, and then the student model learns deep knowledge from the teacher model through distillation loss. At the same time, the cross entropy loss function learns intrinsic features from the true label; finally, the hybrid loss function obtained by combining the distillation loss function and the cross entropy loss function is shown in formula (14): L Global =(1-λ)·L ResD (p(z t ,T),p(z s ,T))+λ·L CE (y,p(z s ,T=1)) (14) Among them, λ is the weight used to balance the two losses; Step 2.4) Training the model is as follows: First, based on the knowledge distillation model constructed by ResNet and ViT, a pre-trained ResNet is used as the teacher model to guide the training of the ViT student model; using the data in the training set, the ViT student model is trained through an adaptive moment estimation optimizer.

6. The heartbeat signal identity recognition method based on knowledge distillation as claimed in claim 5, characterized in that: Step 3), testing phase, is as follows: Step 3.1) Select the test set; Step 3.2) Load the teacher model and its weights, and then load the student model and its weights obtained after knowledge distillation training; Step 3.3) Input the test set data into the student model trained by knowledge distillation for evaluation; Step 3.4) Calculate the accuracy of the model.

7. The heartbeat signal identification method based on knowledge distillation as claimed in claim 6, characterized in that the steps 3.4) The details are as follows: Initialize two counters, correct and total. Correct is used to record the number of samples predicted correctly, and total is used to record the total number of samples. Then, iterate over each sample in the test set, use the knowledge distillation model to predict and obtain the predicted label. If the predicted label is the same as the true label, the correct counter is incremented by 1. After each prediction, the total counter is incremented by 1. Finally, calculate the accuracy by dividing correct by total.

8. A heartbeat signal identification system based on knowledge distillation, for executing the method according to any one of claims 1 to 7, characterized in that: Includes the following units: Data preprocessing unit: The millimeter-wave radar collects heartbeat signals, performs segmented processing, and obtains a log-mel spectrum graph for each segment of the heartbeat signal through frequency domain analysis. The log-mel spectrum graph set is divided into a training set and a test set. Training unit: First, a knowledge distillation model is built based on the residual network ResNet and ViT. ResNet is used as the teacher model to guide the training of the ViT student model. Then, the knowledge distillation model training is completed based on the training set. Testing unit: Use the trained knowledge distillation model to test the test set and calculate the model accuracy.

9. A storage medium, characterized in that: Computer instructions are stored, wherein the computer instructions are used to cause a computer to execute the method according to any one of claims 1 to 7 or the system according to claim 8.

10. An electronic device, characterized in that: include: processor; The memory is used to store a program, and when the program is called and executed by the processor, the processor executes the method according to any one of claims 1 to 7 or the system according to claim 8.

Citation Information

Patent Citations

  • Methods and systems for non-invasive gene detection using artificial intelligence (ai) models

    CN114846507A

  • Method and apparatus for coding a noise-suppressed audio signal

    US20040083095A1