Music emotion regulation sleep aiding method and system combined with emotion calculation

Through the quantum-inspired fractal attention multimodal fusion network and improved conditional variational autoencoder, combined with the SoftActor-Critic algorithm, the shortcomings of emotion recognition and music generation in the existing technology are solved, and high precision, personalization and The adaptive musical mood regulation sleep aid system has significantly improved sleep quality and user satisfaction.

CN119303205APending Publication Date: 2025-01-14COSONIC INTELLIGENT TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411444648.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

The existing music-assisted sleep technology cannot accurately identify users' emotional changes, lacks personalization and real-timeness, and is difficult to meet users' unique needs, and lacks effective learning mechanisms to optimize adjustment strategies, resulting in insufficient emotional recognition accuracy and limited music generation quality. and poor long-term adaptability.

Method used

The quantum-inspired fractal attention multimodal fusion network is used for high-precision emotion recognition, combined with the improved conditional variational autoencoder to generate personalized music sequences, and optimize the emotion regulation strategy through the SoftActor-Critic algorithm to realize the system's adaptive and adaptive Long-term study.

Benefits of technology

It significantly improves the accuracy of emotion recognition, the degree of personalized music generation and user satisfaction, significantly improves sleep quality, and achieves rapid response and interpretability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119303205A_ABST
    Figure CN119303205A_ABST
Patent Text Reader

Abstract

The invention discloses a music emotion regulation sleep aiding method and system combined with emotion calculation. The method comprises the following steps: acquiring multi-modal data of a user; based on the multi-modal data, performing emotional state analysis by adopting a fractal attention multi-modal fusion network inspired by quantum to obtain fused emotional features; based on the fused emotional features, establishing a mapping relation between music features and emotional states; generating a personalized music sequence according to the mapping relation; based on the personalized music sequence and the emotional characteristics, optimizing an emotional regulation strategy; playing the personalized music sequence and collecting user feedback; based on the user feedback, the emotion adjustment strategy is updated, through the fractal attention multi-modal fusion network inspired by quantum, multi-scale and multi-modal emotion feature extraction and fusion are realized, and the accuracy of emotion recognition is significantly improved. Test results show that the emotion improvement degree (EI) reaches 85 and is far higher than that in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of music emotion regulation and sleep-aiding methods, and more specifically, to a music emotion regulation and sleep-aiding method combined with emotion computing and a system thereof. Background Art

[0002] In recent years, as people's requirements for quality of life have increased, sleep quality issues have received increasing attention. At the same time, music therapy, as a non-invasive auxiliary treatment method, has shown great potential in improving sleep quality and regulating emotions. However, the existing music-assisted sleep technology still has many shortcomings and is difficult to meet the personalized and real-time needs of users. At present, there are mainly the following types of music-assisted sleep technologies:

[0003] 1. Traditional music recommendation system: recommends music based on user historical preferences and tag matching. Although this method is simple and direct, it cannot respond to user mood changes in real time, and it is difficult to improve sleep quality in a targeted manner.

[0004] 2. Simple emotion recognition system: Usually only relies on a single modality (such as facial expression recognition) to select preset music. Although this method takes emotional factors into consideration, it is difficult to accurately grasp the user's true emotional state due to the limitations of information acquisition.

[0005] 3. Fixed white noise playing system: Play fixed white noise or natural sound to assist sleep. Although simple and easy, it lacks personalization and adaptability and cannot meet the needs of different users in different situations.

[0006] 4. Music generation system based on physiological signals: Use physiological signals such as heart rate and breathing to adjust music parameters. Although this method takes into account the user's physiological state, it ignores emotional factors and is difficult to fully meet the user's psychological needs.

[0007] The main problems with the above methods include:

[0008] 1. Insufficient emotion recognition accuracy: Single modality or simple multimodal fusion methods are difficult to accurately capture complex human emotional states.

[0009] 2. Insufficient personalization: Preset music libraries or simple parameter adjustments can hardly meet the unique needs of each user.

[0010] 3. Lack of real-time performance: Many systems cannot respond to instantaneous changes in user emotions in a timely manner.

[0011] 4. Poor long-term adaptability: Lack of effective learning mechanism makes it difficult to optimize adjustment strategies based on long-term user feedback.

[0012] 5. Limited quality of music generation: Existing systems often use simple music selection or parameter adjustments, which makes it difficult to generate high-quality, emotional music sequences.

[0013] In particular, we conducted an in-depth study of the state-of-the-art deep learning-based music emotion regulation system. This system uses a convolutional neural network (CNN) for emotion recognition and a recurrent neural network (RNN) to generate music sequences. However, we found that this system still has the following problems:

[0014] 1. CNN-based emotion recognition models are difficult to capture the temporal dynamic characteristics of emotions.

[0015] 2. A single RNN music generation model is difficult to balance the creativity and emotional expression of music.

[0016] 3. Lack of effective strategy optimization mechanism makes it difficult to adjust system parameters based on long-term effects.

[0017] 4. The model has poor interpretability, making it difficult to understand and improve the system’s decision-making process.

[0018] These problems seriously restrict the application effect of music emotion regulation technology in improving sleep quality. Therefore, it is particularly necessary to develop an intelligent music emotion regulation system that can accurately identify emotions, generate personalized music, and have long-term learning capabilities. Summary of the invention

[0019] The present invention aims at the above problems and proposes a music emotion regulation and sleep aid method and system combined with emotional computing. The method integrates cutting-edge technologies such as quantum computing, fractal theory and deep learning, and realizes high-precision emotion recognition, personalized music generation and adaptive regulation strategy optimization.

[0020] The present invention provides a music emotion regulation and sleep-aiding method combined with emotional computing, comprising the following steps:

[0021] Obtain multimodal data of users;

[0022] Based on the multimodal data, a quantum-inspired fractal attention multimodal fusion network is used to analyze the emotional state and obtain fused emotional features;

[0023] Based on the fused emotional features, establishing a mapping relationship between music features and emotional states;

[0024] Generate a personalized music sequence according to the mapping relationship;

[0025] Optimizing an emotion regulation strategy based on the personalized music sequence and the emotion characteristics;

[0026] Playing the personalized music sequence and collecting user feedback;

[0027] Based on the user feedback, the emotion regulation strategy is updated.

[0028] Specifically, the quantum-inspired fractal attention multimodal fusion network includes the following steps: mapping the input data to the quantum state space to obtain the quantum state representation: |ψ i >=∑ j α ij |j>

[0029] Among them, |ψ i > represents the quantum state of the i-th mode, α ij is the complex amplitude, |j> is the calculation ground state;

[0030] Perform quantum entanglement operation on the quantum state representation:

[0031]

[0032] Among them, CNOT is the control NOT gate operation, represents tensor product;

[0033] Applying fractal attention mechanism:

[0034] A f (X) = σ(W f ·(X+λ·A f (X↓)))

[0035] Among them, X is the input feature, X↓ represents the downsampling operation, and W f is a learnable weight matrix, λ is the recursive depth control parameter, and σ is the activation function;

[0036] Perform quantum measurements to map quantum states back to classical data:

[0037] O i =<Φ|M i |Φ>

[0038] Among them, M i is the measurement operator, O i is the measurement result, performing fractal dimension embedding:

[0039] E f =FractalInterpolation(O,D)

[0040] Among them, O is the result of quantum measurement, and D is the target fractal dimension;

[0041] Feature fusion via nonlinear dynamics:

[0042]

[0043] Among them, X, Y, Z are the fused features, and σ, ρ, β are learnable parameters.

[0044] Specifically, the establishment of the mapping relationship between music features and emotional states includes the following steps: extracting music features M using a pre-trained music feature extractor; and performing nonlinear mapping on the fused emotional features F:

[0045] E = tanh(W e ·F+b e )

[0046] Among them, W e and b e is a learnable parameter, which is learned using contrastive learning technique and InfoNCE loss function:

[0047]

[0048] Among them, sim is the cosine similarity function and τ is the temperature parameter.

[0049] Specifically, the generation of personalized music sequence adopts an improved conditional variational autoencoder, including the following steps:

[0050] The latent variable distribution is obtained through the encoder:

[0051] q(z|x,c)=N(μ e ,σ e )

[0052] Where x is the input music, c is the condition (emotional state), and z is the latent variable; the music sequence is generated by the decoder:

[0053] p(x|z,c)=Deconv(z,c)

[0054] Among them, Deconv is a transposed convolutional network;

[0055] Optimization loss function: L = Reconstruction_Loss + KL_Divergence + Style_Loss

[0056] Among them, Style_Loss is the style consistency loss based on the Gram matrix.

[0057] Specifically, the optimized emotion regulation strategy adopts an improved SoftActor-Critic algorithm, including the following steps:

[0058] Define the state space:

[0059] S=[F,M,T]

[0060] Among them, F is the emotional feature, M is the current music feature, and T is the time feature;

[0061] Define the action space:

[0062] A=[Tempo,Pitch,Volume,Instrument]

[0063] Define the reward function:

[0064] R=w1·Emotion_Improvement+w2·Sleep_Quality+w3·User_Preference

[0065] Among them, w1, w2, w3 are weight parameters;

[0066] Update policy network:

[0067] π(a|s)=softmax(W π ·φ(s)+b π )

[0068] Where φ(s) is the nonlinear feature extractor of the state, W π and b π is a learnable parameter;

[0069] Update value network:

[0070] V(s)=W v ·φ(s)+b v

[0071] Among them, W v and b v are learnable parameters.

[0072] Specifically, the playing of the personalized music sequence adopts a high-quality audio interface ES9038PRO DAC.

[0073] Specifically, collecting user feedback includes the following steps:

[0074] The quantum-inspired fractal attention multimodal fusion network is used to monitor the user's emotional state in real time; the smart bracelet Fitbit Sense is used to collect sleep data; and the user's subjective feedback is collected through a voice interface or gesture operation.

[0075] Specifically, the data integration steps include:

[0076] Integrate real-time emotion data, sleep quality data and user feedback to form a comprehensive evaluation index: Feedback = w1·Emotion_Score+w2·Sleep_Score+w3·User_Score

[0077] Among them, w1, w2, w3 are weight parameters.

[0078] Specifically, the updating of the emotion regulation strategy includes the following steps:

[0079] Based on the user feedback, updating the weight parameters in the reward function;

[0080] Based on the user feedback, fine-tune the quantum-inspired fractal attention multimodal fusion network.

[0081] A music emotion regulation and sleep aid system combined with emotional computing, comprising:

[0082] A multimodal data acquisition module, used to obtain multimodal data of users;

[0083] An emotional state analysis module, used to perform emotional state analysis based on the multimodal data using a quantum-inspired fractal attention multimodal fusion network to obtain fused emotional features;

[0084] A mapping relationship establishment module, used to establish a mapping relationship between music features and emotional states based on the fused emotional features;

[0085] A music generation module, used for generating a personalized music sequence according to the mapping relationship;

[0086] A strategy optimization module, used for optimizing the emotion regulation strategy based on the personalized music sequence and the emotion characteristics;

[0087] A music playing module, used for playing the personalized music sequence;

[0088] Feedback collection module, used to collect user feedback;

[0089] A strategy updating module is used to update the emotion regulation strategy based on the user feedback.

[0090] The beneficial effects of the present invention are mainly reflected in the following aspects:

[0091] 1. High-precision emotion recognition: Through the quantum-inspired fractal attention multimodal fusion network (QIFAMFN), multi-scale and multi-modal emotion feature extraction and fusion are realized, which significantly improves the accuracy of emotion recognition. The test results show that the emotion improvement index (EI) of the present invention reaches 85, which is much higher than the existing technology.

[0092] 2. Personalized music generation: Using an improved conditional variational autoencoder (CVAE), it can generate music sequences that are highly matched to the user's current mood. The personalization degree (PD) is as high as 95, which greatly improves the user experience.

[0093] 3. Adaptive adjustment strategy: The SoftActor-Critic (SAC) algorithm was introduced to achieve strategy optimization based on long-term feedback, enabling the system to continuously adapt to the personalized needs of users. This is reflected in the high user satisfaction (US) score of 9.2.

[0094] 4. Significantly improve sleep quality: Through precise emotion regulation and personalized music generation, the present invention performs well in improving sleep quality. The Sleep Quality Index (SQI) reaches 92, far exceeding other methods.

[0095] 5. Real-time response: Despite the high complexity of the system, a fast response time of 2.5 seconds is still achieved through optimized algorithms and hardware configuration, ensuring a good user experience.

[0096] 6. Interpretability: The modular design and quantum computing-based approach of the present invention improve the interpretability of the system, which is conducive to further optimization and improvement.

[0097] In summary, the present invention overcomes many defects of the prior art and provides an efficient, personalized and adaptive music emotion regulation sleep aid method and system, which has significant advantages in improving sleep quality and improving emotional state, and has important practical application value. BRIEF DESCRIPTION OF THE DRAWINGS

[0098] Figure 1 This is a flow chart of a music emotion regulation and sleep-aiding method combined with emotion computing according to the present invention.

[0099] Figure 2 This is a schematic diagram of the framework of the music emotion regulation and sleep aid system combined with emotional computing of the present invention. DETAILED DESCRIPTION

[0100] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects thereof are described in detail below in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0101] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0102] The purpose of the present invention is to provide a music emotion regulation and sleep-aiding method and system combined with emotional computing, which can generate personalized music sequences by intelligently analyzing the user's emotional state to achieve the purpose of emotion regulation and improving sleep quality.

[0103] To achieve the above object, the present invention provides the following technical solutions:

[0104] Please refer to Figure 1 , a music emotion regulation and sleep aid method combined with emotional computing, comprising the following steps:

[0105] 1. Multimodal data acquisition step: When the user is ready to fall asleep, the system first acquires the user's multimodal data. This data includes:

[0106] 1.1 Voice data: The user's voice is collected through a high-sensitivity microphone (such as ShureSM7B). The system prompts the user to briefly describe their mood or feelings for the day.

[0107] 1.2 Facial expression data: Use an infrared camera (such as Intel Real Sense D435) to capture the user's facial expressions in a low-light environment.

[0108] 1.3 Physiological signal data: collect the user's heart rate, skin conductivity, body temperature and other physiological indicators through smart bracelets (such as Fitbit Sense).

[0109] 2. Emotional state analysis step: Based on the acquired multimodal data, the system uses the quantum-inspired fractal attention multimodal fusion network (QIFAMFN) to analyze the emotional state and obtain the fused emotional features. The specific steps of QIFAMFN are as follows:

[0110] 2.1 Quantum state feature extraction, for each modality (speech, facial expression, physiological signal), the system maps the input data to the quantum state space: |ψ i >=∑ j α ij |j>

[0111] Among them, |ψ i > represents the quantum state of the i-th mode, α ij is the complex amplitude, and |j> is the computational basis state. For example, for speech data, the system may map features such as pitch, volume, and speech rate to different basis states.

[0112] 2.2 Quantum entanglement layer, in order to capture the complex interactions between modes, the system introduces a quantum entanglement layer:

[0113]

[0114] Among them, CNOT is the control NOT gate operation, represents the tensor product. This step allows information from different modalities to influence each other, for example, the tension of the voice may affect the interpretation of facial expressions.

[0115] 2.3 Fractal Attention Mechanism,The system applies a new fractal attention mechanism, which recursively applies attention at different scales:

[0116]

[0117] Among them, X is the input feature, X↓ represents the downsampling operation, and W f is a learnable weight matrix, λ is a recursive depth control parameter (usually between 0.1 and 0.9), and σ is an activation function (such as ReLU). This mechanism allows the system to capture emotional features at multiple scales, from subtle facial muscle changes to overall emotional expressions.

[0118] 2.4 Quantum measurement layer, mapping quantum states back to classical data through quantum measurement:

[0119] O i =<Φ|M i |Φ>

[0120] Among them, M i is the measurement operator, O i is the measurement result. This step converts the quantum representation back into interpretable classical data

[0121] 2.5 Fractal Dimension Embedding, the system introduces fractal dimension embedding to capture the multi-scale characteristics of emotions:

[0122] E f =FractalInterpolation(O,D)

[0123] Among them, O is the result of quantum measurement, and D is the target fractal dimension (usually between 1.5 and 2.5). Fractallnterpolation is a fractal interpolation algorithm based on an iterated function system, which can capture subtle changes and overall trends in emotions.

[0124] 2.6 Nonlinear dynamics fusion,Finally, the system uses a nonlinear dynamics system based on chaos theory for,feature fusion:

[0125]

[0126] Among them, X, Y, Z are fused features, σ, ρ, β are learnable parameters. The initial values ​​can be set to: σ = 10, ρ = 28, β = 8 / 3. This system can capture the complexity and nonlinear characteristics of emotional dynamics and output the fused emotional features F = [X, Y, Z].

[0127] 3. Music feature and emotional state mapping step: Based on the fused emotional features, the system establishes a mapping relationship between music features and emotional states. The specific steps are as follows:

[0128] 3.1 Music Feature Extraction,The system uses the pre-trained music feature extractor MusicBERT to extract music features M. MusicBERT is a Transforme-based model that can extract rich music features from raw audio, including rhythm, harmony, timbre, etc.

[0129] 3.2 Emotional feature processing, the system passes the emotional feature F obtained in step 2 through a nonlinear mapping function:

[0130] E = tanh(W e ·F+b e )

[0131] Among them, W e and b e is a learnable parameter. The tanh function compresses the eigenvalues ​​into the range of [-1, 1], which helps in subsequent contrastive learning.

[0132] 3.3 Contrastive Learning, the system uses the InfoNCE loss function for contrastive learning:

[0133]

[0134] Among them, sin is the cosine similarity function and τ is the temperature parameter (usually between 0.1 and 1). The purpose of this step is to learn a common embedding space so that matching music features and emotional features are close in this space.

[0135] 4. Personalized music sequence generation step: According to the established mapping relationship, the system generates a personalized music sequence. This step uses an improved conditional variational autoencoder (CVAE), as follows:

[0136] 4.1 Encoder

[0137] q(z|x,c)=N(μ e , σ e )

[0138] Where x is the input music, c is the condition (emotional state), and z is the latent variable. e and σ e are the mean and standard deviation generated by the neural network.

[0139] 4.2 Decoder

[0140] p(x|z,c)=Deconv(z,c)

[0141] Among them, Deconv is a transposed convolutional network. It takes the latent variable z and the condition c as input to generate music sequences.

[0142] 5. Emotion regulation strategy optimization step: Based on the generated personalized music sequence and emotion characteristics, the system optimizes the emotion regulation strategy. This step uses the improved SoftActor-Critic (SAC) algorithm, as follows:

[0143] 5.1 State Space Definition

[0144] S=[F,M,T]

[0145] Among them, F is the emotional feature, M is the current music feature, and T is the time feature (such as the time from falling asleep).

[0146] 5.2 Action Space Definition,

[0147] A=[Tempo,Pitch,Volume,Instrument]

[0148] These parameters determine how the music sequence should be adjusted to achieve the best emotion regulation effect.

[0149] 5.3 Reward Function Definition

[0150] R=w1·Emotion_Improvement+w2·Sleep_Quality+w3·User_Preference

[0151] Among them, w1, w2, w3 are weight parameters, which can be initially set to be equal (such as 1 / 3).

[0152] Emotion_Improvement measures the degree of mood improvement, Sleep_Quality evaluates sleep quality, and User_Preference considers the user's subjective preference.

[0153] 5.4 Policy Network Update

[0154] π(a|s)=softmax(W π ·φ(s)+b π )

[0155] Where φ(s) is the nonlinear feature extractor of the state, W π and b π are learnable parameters.

[0156] 5.5 Value Network Update

[0157] V(s)=W v·φ(s)+b v

[0158] Among them, W v and b v is a learnable parameter. The system updates the policy network and value network according to the standard update rules of the SAC algorithm to maximize the long-term cumulative reward.

[0159] 6. Music playback step, the system uses the high-quality audio interface ES9038PRO DAC to play the generated personalized music sequence. This high-end DAC can provide extremely high sound quality, ensuring that every detail of the music can be accurately restored, thereby maximizing the emotional adjustment effect of the music.

[0160] 7. User feedback collection step: During the music playing process and after waking up the next day, the system collects user feedback. Specifically including:

[0161] 7.1 Real-time emotion monitoring: The system continuously uses the QIFAMFN algorithm to monitor the user's emotional state changes in real time;

[0162] 7.2 Sleep quality assessment: Collect users’ sleep data through Fitbit Sense smart bracelet, including sleep stages, heart rate variability, body movement frequency, etc.

[0163] 7.3 Subjective feedback collection: After waking up the next day, the system collects the user's subjective evaluation of last night's sleep quality and music experience through a voice interface or simple gesture operations.

[0164] 8. Data integration step: the system integrates the collected feedback data to form comprehensive evaluation indicators:

[0165] Feedback=w1·Emotion_Score+w2·Sleep_Score+w3·User_Score

[0166] Among them, w1, w2, and w3 are weight parameters that can be adjusted according to the user's personal preferences. Emotion_Score is based on emotion monitoring results, Sleep_Score is based on objective sleep data, and User_Score comes from the user's subjective evaluation.

[0167] 9. Emotion Regulation Strategy Update Step: Based on the integrated user feedback, the system updates the emotion regulation strategy

[0168] 9.1 Update weight parameters in the reward function: The system adjusts the values ​​of w1, w2, and w3 in the reward function based on user feedback to better balance mood improvement, sleep quality, and user preferences.

[0169] 9.2Fine-tuneQIFAMFN: The system uses the collected new data to fine-tune the quantum-inspired fractal attention multimodal fusion network to improve the accuracy of emotion recognition.

[0170] 9.3 Update the music generation model: The system adjusts the parameters of the CVAE model based on user feedback to make the generated music more in line with the user's personal preferences and emotional needs.

[0171] 9.4 Optimizing the SAC algorithm: The system updates the policy network and value network in the SAC algorithm based on the long-term accumulated rewards to improve the emotion regulation strategy. Through this closed-loop update process, the system can continuously learn and adapt to the user's personal characteristics and needs, providing more and more personalized and effective music emotion regulation services.

[0172] Please refer to Figure 2 , a music emotion regulation and sleep aid system combined with emotional computing, including:

[0173] Multimodal data acquisition module 1, which is responsible for acquiring the user's voice, facial expression and physiological signal data. It includes hardware devices such as high-sensitivity microphones, infrared cameras and smart bracelets, and uses PyAudio to process audio data, OpenCV to process video data, and a custom physiological signal processing library. The high-sensitivity microphone uses ShureSM7B to collect user voice; the infrared camera uses IntelRealSenseD435 to capture user facial expressions; the smart bracelet uses FitbitSense to collect user physiological signals;

[0174] Emotional state analysis module 2, which implements the quantum-inspired fractal attention multimodal fusion network (QIFAMFN) to analyze the user's emotional state. It includes sub-modules such as quantum state feature extraction, quantum entanglement layer, fractal attention mechanism, quantum measurement layer, fractal dimension embedding and nonlinear dynamics fusion. The high-performance server is equipped with NVIDIA Tesla V100 GPU to run complex deep learning models.

[0175] Mapping relationship establishment module 3, which uses the pre-trained MusicBERT model to extract music features and establishes the mapping relationship between music features and emotional states through comparative learning.

[0176] Music generation module 4, which implements an improved conditional variational autoencoder (CVAE) for generating personalized music sequences. It includes an encoder, a decoder, and a specific loss function calculation unit.

[0177] Strategy optimization module 5, which implements the improved SoftActor-Critic (SAC) algorithm for optimizing emotion regulation strategy. It includes sub-modules such as state space definition, action space definition, reward function calculation, strategy network and value network.

[0178] The music playing module 6 includes a high-quality audio interface ES9038PRO DAC and is used for playing the generated personalized music sequence.

[0179] The feedback collection module 7 is used to collect user feedback.

[0180] The strategy updating module 8 is used to update the emotion regulation strategy based on the user feedback.

[0181] The software implementation mainly includes the following modules:

[0182] 1. Multimodal data processing module 1 uses PyAudio to process audio data, OpenCV to process video data, and a custom physiological signal processing library.

[0183] 2. The Quantum Inspired Fractal Attention Multimodal Fusion Network (QIFAMFN) is implemented using PyTorch, including the quantum computing simulation library Qiskit.

[0184] 3. Music feature extraction uses the pre-trained MusicBERT model, implemented based on HuggingFace’s Transformers library.

[0185] 4. Conditional Variational Autoencoder (CVAE) is implemented using TensorFlow.

[0186] 5.The SoftActor-Critic (SAC) algorithm is implemented using OpenAIGym and StableBaselines3.

[0187] In order to verify the superiority of the present invention, we conducted a series of comparative experiments. The following is a detailed comparison of Example 1 of the present invention and three comparative examples:

[0188] Example 1: Complete implementation of the present invention

[0189] Comparative Example 1: Traditional music recommendation system, recommending music based on user historical preferences

[0190] Comparative Example 2: A simple emotion recognition system that uses only facial expression recognition to select preset music. Comparative Example 3: A fixed white noise playback system

[0191] The test indicators and methods are as follows:

[0192] 1. Emotion Improvement (EI): Use QIFAMFN to analyze the user's emotions before and after music is played, and calculate the degree of change in the emotion towards a positive direction. Range: 0-100.

[0193] 2. Sleep Quality Index (SQI): Based on data collected by Fitbit Sense, including the proportion of deep sleep time, number of sleep interruptions, etc. Range: 0-100.

[0194] 3. User satisfaction (US): obtained through questionnaire survey, with a rating range of 1-10.

[0195] 4. Personalization Degree (PD): Evaluates the matching degree between the generated music and the user’s current emotional state. Range: 0-100.

[0196] 5. System response time (RT): the time from data collection to music generation. Unit: seconds.

[0197] The test results are shown in the following table:

[0198]

[0199]

[0200] Embodiment 1 is the best embodiment, which demonstrates the superiority of the present invention. The specific analysis is as follows:

[0201] 1. Emotion Improvement (EI): The EI of the present invention is significantly higher than that of other comparative examples. This demonstrates the superior performance of the QIFAMFN algorithm in emotion recognition and regulation. The multimodal fusion and quantum-inspired approach can more accurately capture the user's emotional state, thereby generating more effective emotion-regulating music.

[0202] 2. Sleep Quality Index (SQI): The SQI of the present invention reached 92, which is much higher than that of other methods. This shows that the personalized music sequence generated by the present invention can more effectively improve the sleep quality of users. This may be because the present system can dynamically adjust the music according to the user's real-time emotional state and physiological signals to create an optimal sleeping environment.

[0203] 3. User satisfaction (US): The high score of 9.2 reflects the high recognition of users for this system. This may be due to the high personalization and adaptability of the system, which can meet the needs of different users in different situations.

[0204] 4. Personalization Degree (PD): The high score of 95 shows the outstanding performance of the present invention in providing personalized services. This is due to the combination of the CVAE model and the SAC algorithm, which can generate music that highly matches the user's current mood.

[0205] 5. System response time (RT): Although the RT of the present invention is slightly higher than that of other methods, considering the complexity and accuracy of the system, a response time of 2.5 seconds is acceptable and will not affect the user experience.

[0206] These results fully demonstrate the innovations of the present invention, including the effectiveness of the quantum-inspired fractal attention multimodal fusion network (QIFAMFN), the improved conditional variational autoencoder (CVAE), and the SoftActor-Critic (SAC) algorithm. QIFAMFN significantly improves the accuracy of emotion recognition, CVAE successfully generates highly personalized music sequences, and the SAC algorithm effectively optimizes long-term emotion regulation strategies.

[0207] In general, the present invention significantly outperforms existing methods in key indicators such as mood improvement, sleep quality improvement, user satisfaction and personalization. This not only verifies the technical superiority of the present invention, but also proves its great potential in practical applications. Although there is a slight sacrifice in system response time, this trade-off is worth it considering the significantly improved performance. Future optimization directions can focus on further improving the real-time performance of the system while maintaining its high accuracy and personalization level.

[0208] It should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A music emotion regulation and sleep aid method combined with emotional computing, characterized in that: The following steps are involved: Obtain multimodal data of users; Based on the multimodal data, a quantum-inspired fractal attention multimodal fusion network is used to analyze the emotional state and obtain fused emotional features; Based on the fused emotional features, establishing a mapping relationship between music features and emotional states; Generate a personalized music sequence according to the mapping relationship; Optimizing an emotion regulation strategy based on the personalized music sequence and the emotion characteristics; Playing the personalized music sequence and collecting user feedback; Based on the user feedback, the emotion regulation strategy is updated.

2. The method according to claim 1, characterized in that The quantum-inspired fractal attention multimodal fusion network includes the following steps: mapping the input data to the quantum state space to obtain the quantum state representation: |ψ i >=∑ j α ij |j> Among them, |ψ i > represents the quantum state of the i-th mode, α ij is the complex amplitude, |j> is the calculation ground state; Perform quantum entanglement operation on the quantum state representation: Among them, CNOT is the control NOT gate operation, represents tensor product; Applying fractal attention mechanism: A f (X)=σ(W f ·(X+λ·A f (X↓)) Among them, X is the input feature, X↓ represents the downsampling operation, and W f is a learnable weight matrix, λ is the recursive depth control parameter, and σ is the activation function; Perform quantum measurements to map quantum states back to classical data: The i =<Φ|M i |Φ〉 Among them, M i is the measurement operator, O i is the measurement result, performing fractal dimension embedding: E f =FractalInterpolation(O,D) Among them, O is the result of quantum measurement, and D is the target fractal dimension; Feature fusion via nonlinear dynamics: Among them, X, Y, Z are the fused features, and σ, ρ, β are learnable parameters.

3. The method according to claim 1, characterized in that The mapping relationship between music features and emotional states is established by: extracting music features M using a pre-trained music feature extractor; and performing nonlinear mapping on the fused emotional features F: E=tanh(W e ·F+b e ) Among them, W e and b e is a learnable parameter, which is learned using contrastive learning technique and InfoNCE loss function: Among them, sim is the cosine similarity function and τ is the temperature parameter.

4. The method according to claim 1, characterized in that: The method for generating a personalized music sequence adopts an improved conditional variational autoencoder, and includes the following steps: The latent variable distribution is obtained through the encoder: q(z|x,c)=N(μ e ,s e ) Where x is the input music, c is the condition (emotional state), and z is the latent variable; the music sequence is generated by the decoder: p(x|z,c)=Deconv(z,c) Among them, Deconv is a transposed convolutional network; Optimization loss function: L = Reconstruction_Loss + KL_Divergence + Style_Loss Among them, Style_Loss is the style consistency loss based on the Gram matrix.

5. The method according to claim 1, characterized in that The optimized emotion regulation strategy adopts an improved SoftActor-Critic algorithm. The following steps are involved: Define the state space: S=[F,M,T] Among them, F is the emotional feature, M is the current music feature, and T is the time feature; Define the action space: A=[Tempo,Pitch,Volume,Instrument] Define the reward function: R=w1·Emotion_Improvement+w2·Sleep_Quality+w3·User_Preference Among them, w1, w2, w3 are weight parameters; Update policy network: π(a|s)=softmax(W π ·φ(s)+b π ) Where φ(s) is the nonlinear feature extractor of the state, W π and b π is a learnable parameter; Update value network: V(s)=W v ·φ(s)+b v Among them, W v and b v are learnable parameters.

6. The method according to claim 1, characterized in that The playing of the personalized music sequence adopts the high-quality audio interface ES9038PRODAC.

7. The method according to claim 1, characterized in that The collecting of user feedback comprises the following steps: The quantum-inspired fractal attention multimodal fusion network is used to monitor the user's emotional state in real time; the smart bracelet Fitbit Sense is used to collect sleep data; and the user's subjective feedback is collected through a voice interface or gesture operation.

8. The method according to claim 7, characterized in that The data integration steps include: Integrate real-time emotion data, sleep quality data and user feedback to form a comprehensive evaluation index: Feedback = w1·Emotion_Score+w2·Sleep_Score+w3·User_Score Among them, w1, w2, w3 are weight parameters.

9. The method according to claim 1, characterized in that: The updating of the emotion regulation strategy comprises the following steps: Based on the user feedback, updating the weight parameters in the reward function; Based on the user feedback, fine-tune the quantum-inspired fractal attention multimodal fusion network.

10. A music emotion regulation and sleep aid system combined with emotional computing, characterized in that: include: A multimodal data acquisition module, used to obtain multimodal data of users; An emotional state analysis module, used to perform emotional state analysis based on the multimodal data using a quantum-inspired fractal attention multimodal fusion network to obtain fused emotional features; A mapping relationship establishment module, used to establish a mapping relationship between music features and emotional states based on the fused emotional features; A music generation module, used for generating a personalized music sequence according to the mapping relationship; A strategy optimization module, used for optimizing the emotion regulation strategy based on the personalized music sequence and the emotion characteristics; A music playing module, used for playing the personalized music sequence; Feedback collection module, used to collect user feedback; A strategy updating module is used to update the emotion regulation strategy based on the user feedback.

Citation Information

Cited By

  • Music recommendation method and device, music emotion determination method and device, equipment and medium

    CN121462835A