Relaxation degree identification method and device, electronic equipment and storage medium
By collecting pulse wave signals on wearable devices and using supervised comparison learning models for relaxation recognition, the problem of low relaxation recognition accuracy in the prior art is solved, and higher recognition accuracy and better user experience are achieved.
Patent Information
- Application Number
- CN202311269603.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2043-09-27
AI Technical Summary
In the prior art, the algorithm used to monitor changes in human physiological parameters for relaxation recognition is low accuracy, resulting in poor user experience.
By collecting the pulse wave signals of the target object and identifying them based on the relaxation recognition model pre-trained with the supervised comparison learning method, the accuracy of relaxation recognition is improved.
The method can be run on portable relaxation detection devices and wearable devices, providing more accurate intelligent prediction of relaxation status and improving user experience.
Smart Images

Figure CN119700109A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of relaxation therapy, and more specifically, to a method, device, electronic device and storage medium for identifying relaxation degree in the field of relaxation therapy. Background Art
[0002] As people’s work and life pressures continue to increase, stress, anxiety and depression have become one of the more and more frequent mental illnesses in today’s society. They can disrupt a person’s normal daily life and in some cases may deteriorate into trauma. Therefore, how to reduce people’s stress has become an important issue in reducing the incidence of these diseases.
[0003] In the prior art, human body pressure can be monitored based on non-wearable devices. When using non-wearable devices for detection, although the accuracy of vital sign signal acquisition is relatively high, since it needs to be achieved through external lead wires or external sensors, the equipment is large in size and complicated to operate, and is only suitable for use indoors and in a stationary state.
[0004] In recent years, some wearable devices can also monitor changes in human physiological parameters. Wearable devices are small in size and are not restricted by indoor and outdoor environments. They are more suitable for use in actual environments. However, in the prior art, the algorithm for using wearable devices to monitor changes in human physiological parameters for relaxation recognition is mainly based on the threshold method. The relaxation recognition accuracy is low, and wrong judgments often occur, resulting in poor user experience. Summary of the invention
[0005] The present application provides a method, device, electronic device and storage medium for identifying relaxation level, which can improve the accuracy of relaxation level identification and enhance the user experience.
[0006] In a first aspect, a method for identifying relaxation is provided, the method comprising: collecting a pulse wave signal of a target object; preprocessing the pulse wave signal to obtain a target pulse wave signal; inputting the target pulse wave signal into a pre-trained relaxation recognition model to obtain a relaxation index corresponding to the target pulse wave signal; the relaxation recognition model is trained based on a supervised contrast learning method.
[0007] In the above technical solution, the pulse wave signal of the target object is obtained, and the relaxation index corresponding to the pulse wave signal is identified based on the relaxation recognition model pre-trained by the supervised contrastive learning method. Since the relaxation index can be directly obtained by analyzing the pulse wave, the method can be run on portable relaxation detection devices and wearable devices (such as smart watches, rings, etc.), providing a good choice for intelligent prediction of relaxation state. The supervised contrastive learning method can iteratively train the relaxation recognition model, which can improve the recognition accuracy of the relaxation recognition model.
[0008] In combination with the first aspect, in some possible implementations, after obtaining the relaxation index corresponding to the target pulse wave signal, the method also includes: determining whether the relaxation index is less than a preset threshold; when the relaxation index is less than the preset threshold, performing a target relaxation operation based on the relaxation index to relax the target object.
[0009] In the above technical solution, performing a target relaxation operation based on the relaxation index can help the target object reduce stress, and improving the relaxation index of the target object means that the target object is in a relaxed state, which can improve the target object's usage experience.
[0010] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the relaxation recognition model includes a feature extraction model and a supervised contrast learning model, and the target pulse wave signal is input into a pre-trained relaxation recognition model to obtain a relaxation index corresponding to the target pulse wave signal, including: extracting N signal segments from the target pulse wave signal in preset units by the feature extraction model and processing them to obtain a feature map containing N signal segments; wherein N is greater than or equal to 1; and analyzing and comparing the feature map by a supervised contrast learning model to obtain relaxation indexes of the N signal segments.
[0011] In the above technical solution, by dividing the target pulse wave signal into N signal segments and obtaining the relaxation index of the N signal segments, the target object can more clearly understand the specific values of the relaxation index corresponding to different segments, and the changing trend of the relaxation index can be understood by combining the relaxation index of the N signal segments.
[0012] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, when the N signal segments include a current signal segment and a previous signal segment of the previous signal segment, the relaxation index corresponding to the current signal segment is a first relaxation index, and the relaxation index corresponding to the previous signal segment is a second relaxation index; after performing a target relaxation operation based on the relaxation index, the method also includes: adjusting a target working parameter corresponding to the target relaxation operation according to a change in the first relaxation index relative to the second relaxation index; wherein, when the target relaxation operation is an audio relaxation operation, the target working parameter is volume; when the target relaxation operation is a cooling relaxation operation, the target working parameter is temperature.
[0013] In the above technical solution, by adjusting the working parameters of the target relaxation operation through the change of the first relaxation index relative to the second relaxation index, relaxation feedback adjustment of the target object can be achieved, which can help the target object relax faster and more effectively and maintain mental and physical health.
[0014] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, when the target relaxation operation is an audio relaxation operation, the target working parameters corresponding to the target relaxation operation are adjusted according to the change of the first relaxation index relative to the second relaxation index, including: when the first relaxation index increases relative to the second relaxation index, reducing the volume of the played audio; when the first relaxation index decreases or remains unchanged relative to the second relaxation index, increasing the volume of the played audio.
[0015] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, after increasing the volume of the played audio when the first relaxation index decreases or remains unchanged relative to the second relaxation index, the method also includes: continuously identifying the relaxation index of the target object; when the relaxation of the target object continues to decrease or remains unchanged within a preset time period, determining the relaxation level of the current relaxation index; selecting the target audio corresponding to the relaxation level from a pre-stored audio library for playback; the pre-stored audio library includes multiple audios and their corresponding relaxation levels.
[0016] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, when the target relaxation operation is a cooling relaxation operation, the target working parameters corresponding to the target relaxation operation are adjusted according to the change of the first relaxation index relative to the second relaxation index, including: when the first relaxation index increases relative to the second relaxation index, increasing the temperature within a preset temperature range; when the first relaxation index decreases or remains unchanged relative to the second relaxation index, decreasing the temperature within a preset temperature range.
[0017] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the method is applied to a first electronic device, and a target relaxation operation is performed based on a relaxation index, including: detecting a second electronic device connected to the first electronic device; when it is detected that the first electronic device is connected to the second electronic device, controlling the second electronic device to perform the target relaxation operation based on the relaxation index; when it is not detected that the first electronic device is not connected to the second electronic device, establishing a connection between the first electronic device and the second electronic device, and after the connection, controlling the second electronic device to perform the target relaxation operation based on the relaxation index.
[0018] In combination with the first aspect and the above-mentioned implementation manner, in some possible implementation manners, the relaxation recognition model includes a feature extraction model and a supervised contrast learning model. Before inputting the target pulse wave signal into the pre-trained relaxation recognition model, the method also includes: obtaining multiple sample data; the sample data includes multiple pulse wave signal samples and their corresponding annotation information, and the annotation information is used to characterize the relaxation index corresponding to the pulse wave signal samples; using the feature extraction model to extract coding features for the multiple pulse wave signal samples respectively; inputting the coding features extracted from the multiple pulse wave signal samples and the annotation information corresponding to the multiple pulse wave signal samples into the supervised contrast learning model; in the supervised contrast learning model, for specifying any anchor sample in the multiple pulse wave signal samples, the pulse wave signal sample whose difference between the annotation information and the annotation information of the anchor sample is within a preset difference range is determined as a positive sample; and the feature extraction model is iteratively trained with shortening the distance between the coding features of the positive samples as the goal of the supervised contrast learning loss function.
[0019] In the above technical solution, a new self-supervised contrast loss function is used to allow each anchor point to have multiple positive samples and allow positive samples to have a certain threshold range. The feature encoder and the supervised contrast regression learning model are combined together, and the feature extraction model is iteratively trained based on the self-supervised contrast regression learning loss function, which can improve the feature extraction performance of the feature extraction model, thereby enabling the trained feature extraction model to more accurately extract features from the pulse wave signal and improve the accuracy of the relaxation recognition model. And by setting the goal of the supervised contrast regression learning loss function to shorten the distance between the encoding features of the positive samples, the model optimization goal can be set for the two combined models, which can further improve the accuracy of model recognition.
[0020] In summary, in this application, the pulse wave signal of the target object is obtained, and the relaxation index corresponding to the pulse wave signal is identified based on the relaxation recognition model pre-trained by the supervised contrast learning method. Since the pulse wave can be directly analyzed to obtain the relaxation index, the method can be run on a portable relaxation detection device and a wearable device (such as a smart watch, a ring, etc.), which provides a good choice for intelligent prediction of relaxation state. The supervised contrast learning method can iteratively train the relaxation recognition model, and can improve the accuracy of the relaxation recognition model. In the above method, performing a target relaxation operation based on the relaxation index can help the target object reduce stress, and improving the relaxation index of the target object means that the target object is in a relaxed state, which can improve the user experience of the target object. By dividing the target pulse wave signal into N signal segments and obtaining the relaxation index of the N signal segments, the target object can be more clearly understood The specific values corresponding to the relaxation index in different segments, combined with the relaxation index of the N signal segments, the changing trend of the relaxation index can be understood. And the working parameters of the target relaxation operation can be adjusted based on the change trend of the relaxation index, and relaxation feedback adjustment can be achieved for the target object, which can help the target object relax faster and more effectively and maintain mental and physical health. Through a new self-supervised contrast loss function, each anchor point is allowed to have multiple positive samples, and the positive samples are allowed to have a certain threshold range. The feature encoder and the supervised contrast regression learning model are combined together, and the feature extraction model is iteratively trained based on the self-supervised contrast regression learning loss function, which can improve the feature extraction performance of the feature extraction model, so that the trained feature extraction model can more accurately extract features from the pulse wave signal and improve the accuracy of the relaxation recognition model. And by setting the goal of the supervised contrast regression learning loss function to shorten the distance between the encoding features of the positive samples, the model optimization goal can be set for the two combined models, which can further improve the accuracy of model recognition.
[0021] In a second aspect, a device for identifying relaxation is provided, which includes: an acquisition module for acquiring a pulse wave signal of a target object; a preprocessing module for preprocessing the pulse wave signal to obtain a target pulse wave signal; an identification module for inputting the target pulse wave signal into a pre-trained relaxation recognition model to obtain a relaxation index corresponding to the target pulse wave signal; the relaxation recognition model is trained based on a supervised contrast learning method.
[0022] In combination with the second aspect, in some possible implementations, the device further includes: a relaxation module, configured to perform a target relaxation operation based on the relaxation index to relax the target object when the relaxation index is less than a preset threshold.
[0023] In combination with the above-mentioned implementation method of the second aspect, in some possible implementation methods, the relaxation recognition model includes a feature extraction model and a supervised comparative learning model, and the recognition module is specifically used to extract N signal segments from the target pulse wave signal in preset units through the feature extraction model and process them to obtain a feature map containing N signal segments; wherein N is greater than or equal to 1; and analyze and compare the feature map through the supervised comparative learning model to obtain the relaxation index of the N signal segments.
[0024] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the device also includes: an adjustment module, which is used for, when the N signal segments include the current signal segment and the previous signal segment of the previous signal segment, the relaxation index corresponding to the current signal segment is the first relaxation index, and the relaxation index corresponding to the previous signal segment is the second relaxation index; according to the change of the first relaxation index relative to the second relaxation index, adjusting the target working parameter corresponding to the target relaxation operation; wherein, when the target relaxation operation is an audio relaxation operation, the target working parameter is volume; when the target relaxation operation is a cooling relaxation operation, the target working parameter is temperature.
[0025] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, when the target relaxation operation is an audio relaxation operation, the adjustment module is specifically used to reduce the volume of the played audio when the first relaxation index increases relative to the second relaxation index; when the first relaxation index decreases or remains unchanged relative to the second relaxation index, increase the volume of the played audio.
[0026] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the device also includes: a switching module, which is used to continuously identify the relaxation index of the target object after increasing the volume of the played audio when the first relaxation index decreases relative to the second relaxation index or remains unchanged; determine the relaxation level of the current relaxation index when the relaxation of the target object continues to decrease or remains unchanged within a preset time period; select the target audio corresponding to the relaxation level from the pre-stored audio library for playback; the pre-stored audio library includes multiple audios and their corresponding relaxation levels.
[0027] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, when the target relaxation operation is a cooling relaxation operation, the adjustment module is specifically used to increase the temperature within a preset temperature range when the first relaxation index increases relative to the second relaxation index; when the first relaxation index decreases or remains unchanged relative to the second relaxation index, reduce the temperature within a preset temperature range.
[0028] In combination with the second aspect and the above implementation, in some possible implementations, the device is a first electronic device, and the relaxation module is specifically used to detect a second electronic device connected to the first electronic device; when it is detected that the first electronic device is connected to the second electronic device, the second electronic device is controlled to perform a target relaxation operation based on the relaxation index; when it is not detected that the first electronic device is not connected to the second electronic device, a connection is established between the first electronic device and the second electronic device, and after the connection is made, the second electronic device is controlled to perform the target relaxation operation based on the relaxation index.
[0029] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the device also includes: a model training module, used to obtain multiple sample data; the sample data includes multiple pulse wave signal samples and their corresponding annotation information, and the annotation information is used to characterize the relaxation index corresponding to the pulse wave signal sample; using the feature extraction model to extract coding features for the multiple pulse wave signal samples respectively; the coding features extracted from the multiple pulse wave signal samples and the annotation information corresponding to the multiple pulse wave signal samples are input into the supervised contrast learning model; in the supervised contrast learning model, for specifying any anchor sample in the multiple pulse wave signal samples, the pulse wave signal sample whose difference between the annotation information and the annotation information of the anchor sample is within a preset difference range is determined as a positive sample; and the feature extraction model is iteratively trained with the goal of narrowing the distance between the coding features of the positive samples as the goal of the supervised contrast learning loss function.
[0030] In a third aspect, an electronic device is provided, comprising a memory and a processor. The memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, so that the electronic device executes the method in the first aspect or any possible implementation of the first aspect.
[0031] In a fourth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.
[0032] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a schematic flow chart of a method for identifying relaxation degree provided in an embodiment of the present application.
[0034] Figure 2It is a schematic diagram of a pulse wave signal provided in an embodiment of the present application.
[0035] Figure 3 It is a structural schematic diagram of a relaxation degree identification device provided in an embodiment of the present application.
[0036] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] The technical solution in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0038] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0039] As people’s work and life pressures continue to increase, stress, anxiety and depression have become one of the more and more frequent mental illnesses in today’s society. They can disrupt a person’s normal daily life and in some cases may deteriorate into trauma. Therefore, how to reduce people’s stress has become an important issue in reducing the incidence of these diseases.
[0040] Under the influence of stress, depression or anxiety, the human body releases many chemicals and therefore shows changes in non-verbal body language. Therefore, the degree of relaxation can be assessed through audio, video, ECG signals, EEG signals, EMG signals, skin temperature, skin conductance, blood pressure, breathing and other signals.
[0041] According to the different signal acquisition methods, the relaxation detection system can be divided into the following types: 1) Relaxation detection system based on video images, such as detecting stress status based on facial micro-expressions or behavioral movements. Its advantage is that it is non-sensitive, and its disadvantage is that it is limited by the limited coverage of the camera and can only be detected within a fixed range. In addition, the resolution of the camera is limited. When the distance from the camera is far, the recognition rate of expression and accuracy is low, which in turn affects the detection of relaxation. 2) Detection system based on vital signs. It can be further subdivided into relaxation detection systems based on non-wearable devices (EEG caps, electrocardiographs, etc.) and wearable devices (such as bracelets and headbands). When using non-wearable devices for detection, although the acquisition accuracy of vital signs signals is high, it needs to be realized through external lead wires or external sensors. The device is large in size and complicated to operate, and is only suitable for use indoors and in a static state. For the relaxation detection system based on wearable sensors, the principle is that the micro sensor is embedded in the wearable device and used in the form of a bracelet, belt or vest. Wearable devices are small and easy to carry. They can monitor changes in human physiological parameters in real time, are not restricted by indoor and outdoor environments, and are more suitable for use in actual environments. However, the relaxation detection algorithm based on wearable devices in the prior art is mainly based on the threshold method. The threshold method is simple to calculate and easy to deploy, but the recognition accuracy is poor, and wrong judgments often occur, resulting in a poor user experience for the target object.
[0042] In order to solve the above-mentioned problems existing in the prior art, the present invention proposes a relaxation measurement method based on a self-supervised contrastive learning deep model, which uses pulse waves to measure relaxation. It can be run on portable relaxation detection devices and wearable devices (such as smart watches, rings, etc.), and at the same time can improve the accuracy of relaxation recognition and improve the user experience of the target object.
[0043] Figure 1 It is a schematic flow chart of a method for identifying a relaxation level provided in an embodiment of the present application. In the embodiment of the present application, the execution subject is a first electronic device, and the first electronic device can be a wearable device. Optionally, the wearable device can be a smart watch, a bracelet, a ring, etc. In the embodiment of the present application, the wearable device is a smart watch as an example for explanation.
[0044] For example, Figure 1 As shown, the method 100 includes:
[0045] Step 101, collecting a pulse wave signal of a target object;
[0046] The target object is the target object wearing the wearable device. The wearable device is provided with a photoelectric sensor so that the wearable device can collect the pulse wave signal of the target object according to the photoelectric sensor. The pulse wave is formed by the beating (vibration) of the heart propagating along the arteries and blood flow to the periphery, like ripples on the water surface. The pulse wave is slightly different in different locations (aorta, artery or capillary) as the blood circulates in the blood vessels. The collected pulse wave signal has a certain form (wave shape), intensity (wave amplitude), rate (wave speed) and rhythm (wave period). The collected pulse wave can be specifically as follows Figure 2 (a) shown.
[0047] In some embodiments, the wearable device is provided with an acceleration sensor in addition to a photoelectric pulse sensor, which can be used to more accurately collect the pulse wave signal of the human body.
[0048] Optionally, the wearable device may be configured to collect the pulse wave signal of the target object in real time at a preset frequency, or the wearable device may collect the pulse wave of the target object within a preset time period in response to an instruction to collect the pulse wave signal sent by the target object.
[0049] Step 102, preprocessing the pulse wave signal to obtain a target pulse wave signal.
[0050] Preprocessing may specifically include filtering, which can be divided into low-pass filtering, high-pass filtering and band-pass filtering according to frequency response.
[0051] Low-pass filtering can be simply considered as: setting a frequency point, when the signal frequency is higher than this frequency, it cannot pass, and the signal above this frequency is removed. High-pass filtering is the opposite of low-pass filtering. It can be considered as setting a frequency point, only allowing signals above this frequency point to pass, and removing signals below this frequency. Band-pass filtering only allows signals of specific frequencies to pass. It can be simply considered as setting a lower limit frequency and an upper limit frequency, only allowing signals above the lower limit frequency and below the upper limit frequency to pass, and removing signals below the lower limit frequency and above the upper limit frequency.
[0052] Considering that the pulse rate usually ranges from 30 to 300 bpm (beats per minute), the embodiment of the present application performs bandpass filtering on the pulse wave signal, for example, the passband range of the bandpass filtering can be set to 0.5 to 5 Hz to obtain a pulse wave signal after bandpass filtering.
[0053] Preprocessing can also include standardization processing. The target pulse wave signal y can be obtained by standardizing the pulse wave signal after bandpass filtering using formula (1): proc . Where μ is the mean and σ is the standard deviation.
[0054]
[0055] For example, Figure 2 After the pulse wave signal shown in (a) is processed as above, the target pulse wave signal obtained is as follows Figure 2 (b) as shown.
[0056] Step 103, input the target pulse wave signal into a pre-trained relaxation recognition model to obtain a relaxation index corresponding to the target pulse wave signal; the relaxation recognition model is trained based on a supervised contrast learning method.
[0057] The target pulse wave signal is input into a relaxation recognition model pre-trained based on a supervised contrastive learning method. The relaxation recognition model can extract features of the target pulse wave signal and obtain a relaxation index corresponding to the target pulse wave signal based on the extracted features of the target pulse wave signal.
[0058] It should be understood that the relaxation index is used to characterize the current relaxation level of the target object and is negatively correlated with the current stress of the target object. The larger the relaxation index, the more relaxed the target object is and the lower the stress. The smaller the relaxation index, the greater the stress of the target object.
[0059] In the above method, the pulse wave signal of the target object is obtained, and the relaxation index corresponding to the pulse wave signal is identified based on the relaxation recognition model pre-trained by the supervised contrastive learning method. Since the relaxation index can be directly obtained by analyzing the pulse wave, the method can be run on portable relaxation detection devices and wearable devices (such as smart watches, rings, etc.), providing a good choice for intelligent prediction of relaxation state. The supervised contrastive learning method can iteratively train the relaxation recognition model, which can improve the recognition accuracy of the relaxation recognition model.
[0060] In one possible implementation, after obtaining the relaxation index corresponding to the target pulse wave signal, the method further includes: determining whether the relaxation index is less than a preset threshold; when the relaxation index is less than the preset threshold, performing a target relaxation operation based on the relaxation index to relax the target object.
[0061] The relaxation index is negatively correlated with stress. The larger the relaxation index, the lower the stress of the target user. The preset threshold can be relative to the maximum value in the normal stress range. The preset threshold can indicate whether the current stress is high and whether a relaxation operation is required for the target object. When the relaxation index is less than the preset threshold, it indicates that the stress of the target object is greater than the normal stress range and a relaxation operation is required for the target object. When the relaxation index is greater than the preset threshold, it indicates that the stress of the target object is within the normal stress range and no relaxation operation is required for the target object.
[0062] The target relaxation operation can be an operation performed by the wearable device on the target object. It can also be an operation performed by the wearable device controlling other electronic devices on the target object. The target relaxation operation corresponds to certain working parameters, and the target working parameters can be determined according to the relaxation index, and the target relaxation operation is performed with the target working parameters.
[0063] For example, assuming that the relaxation index corresponding to the target pulse wave signal is 37, which is less than the preset threshold value of 60, the relaxation index is less than the preset threshold value, indicating that the target object is under great pressure and needs to be relaxed. Assuming that the working parameters are divided into three levels of low, medium and high, and 37 corresponds to medium, the target relaxation operation is performed with the medium working parameters.
[0064] In the above method, performing a target relaxation operation based on the relaxation index can help the target object reduce stress, and improving the relaxation index of the target object means that the target object is in a relaxed state, which can improve the target object's usage experience.
[0065] In one possible implementation, the method is applied to a first electronic device, and a target relaxation operation is performed based on a relaxation index, including: detecting a second electronic device connected to the first electronic device; when it is detected that the first electronic device is connected to the second electronic device, controlling the second electronic device to perform the target relaxation operation based on the relaxation index; when it is not detected that the first electronic device is not connected to the second electronic device, establishing a connection between the first electronic device and the second electronic device, and after the connection, controlling the second electronic device to perform the target relaxation operation based on the relaxation index.
[0066] The first electronic device is the wearable device mentioned above, and a smart watch is specifically used as an example in the embodiment of the present application, and the second electronic device is another device different from the first electronic device. The second electronic device can establish a connection with the first electronic device, and after the connection is established, the first electronic device can control the second electronic device to perform a target relaxation operation on the target object.
[0067] When the relaxation index of the target object is less than a preset threshold, the first electronic device first detects whether there is a second electronic device currently connected to itself. When it is detected that the first electronic device is connected to the second electronic device, the second electronic device is directly controlled to perform the target relaxation operation. When it is not detected that the first electronic device is connected to the second electronic device, a connection is established between the first electronic device and the second electronic device.
[0068] When the first electronic device detects that it is not connected to the second electronic device, it can first detect whether there is a connectable second electronic device within a certain range around it. The above-mentioned certain range can be the maximum range that the first electronic device can detect. When it is detected that there is a connectable second electronic device around it, the first electronic device can actively connect to the second electronic device, or the first electronic device can remind the target object to connect to the second electronic device, so as to control the second electronic device to perform a relaxation operation on the target object after connecting to the second electronic device.
[0069] Optionally, when the first electronic device connects to the second electronic device in a manner of reminding the target object, the reminder may be displayed in the form of a pop-up window on the interface of the smart watch. For example, the pop-up window may display a text of "Currently the pressure is high, it is recommended to connect the second electronic device to relax" to remind the user to relax. Alternatively, the smart watch may remind the user to relax by playing a voice, and the played voice may be a preset voice containing keywords such as "high pressure", "recommend connecting the second electronic device", and "relax".
[0070] The target relaxation operation includes at least one relaxation operation, and the second electronic device that performs the target relaxation operation may be one or more. The first electronic device may establish connections with multiple second electronic devices at the same time, and control the multiple second electronic devices to perform multiple target operations.
[0071] In some embodiments, the target operation may include a massage relaxation operation, an audio relaxation operation, and a cooling relaxation operation. The second electronic device that can perform the above relaxation operation may be a smart massage chair, a smart headset, a smart cooling headband, and the second electronic device may also include a smart car. A connection such as Bluetooth or Wireless Fidelity (WiFi) may be established between the first electronic device and the second electronic device, which is not limited in the embodiments of the present application.
[0072] Exemplarily, the first electronic device is a smart watch as in the above embodiment, and the second electronic device is assumed to be a smart car, which includes an audio system and an air conditioner, and the target operation is an audio relaxation operation and / or a cooling relaxation operation. When the smart watch detects that the smart car and the smart watch are connected when the relaxation index of the target object is less than a threshold, the smart watch sends an audio control instruction to the smart car to control the smart car to perform an audio relaxation operation on the target object through playing a preset audio through the audio system, and / or the smart watch sends a cooling control instruction to the smart car to control the smart car to perform a cooling relaxation operation on the target object through cooling with the air conditioner.
[0073] In one possible implementation, the relaxation recognition model includes a feature extraction model and a supervised contrast learning model. The target pulse wave signal is input into a pre-trained relaxation recognition model to obtain a relaxation index corresponding to the target pulse wave signal, including: extracting N signal segments from the target pulse wave signal in preset units by the feature extraction model and processing them to obtain a feature map containing N signal segments; wherein N is greater than or equal to 1; and analyzing and comparing the feature map by a supervised contrast learning model to obtain relaxation indexes of the N signal segments.
[0074] The feature extraction model can be a model that uses a feature encoder to extract the coding features in the target pulse wave signal. The feature encoder can be used to extract waveform features and amplitude features of the pulse wave signal to obtain the coding features, namely the above-mentioned feature map.
[0075] The preset unit may include a preset number of sampling points. Assuming that the preset unit is 62 sampling points, the specific process of extracting the coding feature is as follows:
[0076] Step 1, extracting signal segments (seg). Assuming that the target pulse wave signal length input to the relaxation recognition model is 640 (sampling rate of 10s×64), the length of the extracted segment is 62 sampling points, and the extraction step is 2 sampling points, 290 signal segments ((640-62) / 2+1=290) can be extracted, i.e., the above-mentioned N signal segments.
[0077] Step 2: Combine the N signal segments into a matrix and transpose it to generate a two-dimensional data matrix with a size of 62 × 290. The number of rows (channels) is equal to the length of the signal segment (seg) in step 1 (62), and the number of columns (length) is equal to the number of signal segments (seg) (290).
[0078] Step 3, for the data matrix, calculate the standard deviation by column, that is, calculate the standard deviation of 290 segments (segment length is 62), and generate a standard deviation vector representing each column of the data matrix, whose size is 1×290.
[0079] Step 4, morphological encoding, averages the data matrix by column and divides it by the standard deviation calculated in step 3 to obtain a new two-dimensional data matrix with the same size of (62×290). This operation can amplify the changes in the waveform, making it easier for the feature extraction model to capture such changes.
[0080] Step 5, amplitude coding, for the standard deviation vector (1×290) calculated in step 3, calculate its sine and cosine respectively to obtain the sine coding (1×90) and cosine coding (1×90) of the standard deviation vector.
[0081] Step 6, concatenation. Concatenate the encoded waveform image (62×290) in step 4 with the sine code (1×290) and cosine code (1×290) of the standard deviation vector in step 5 row by row to obtain a concatenated feature map (64×290). This feature map is used as the input of the subsequent supervised contrastive learning model. The supervised contrastive model analyzes and processes the obtained feature map to obtain the relaxation index of 290 signal segments.
[0082] In the above method, by dividing the target pulse wave signal into N signal segments and obtaining the relaxation index of the N signal segments, the target object can more clearly understand the specific values of the relaxation index corresponding to different segments, and the change trend of the relaxation index can be understood by combining the relaxation index of the N signal segments.
[0083] In one possible implementation, when N signal segments include a current signal segment and a previous signal segment of the previous signal segment, the relaxation index corresponding to the current signal segment is a first relaxation index, and the relaxation index corresponding to the previous signal segment is a second relaxation index; after performing a target relaxation operation based on the relaxation index, the method further includes: adjusting a target working parameter corresponding to the target relaxation operation according to a change in the first relaxation index relative to the second relaxation index; wherein, when the target relaxation operation is an audio relaxation operation, the target working parameter is volume; when the target relaxation operation is a cooling relaxation operation, the target working parameter is temperature.
[0084] The first electronic device collects the pulse wave signal of the target object in real time, that is, at any time, the N signal segments include the current signal segment and the previous signal segment of the current signal segment, each signal segment corresponds to a relaxation index, the current signal segment corresponds to the first relaxation index, and the previous signal segment corresponds to the second relaxation index.
[0085] The first relaxation index and the second relaxation index can be compared to obtain the change of the first relaxation index relative to the second relaxation index. The first relaxation index and the second relaxation index have three situations: greater than, less than, and the same. Therefore, the change of the first relaxation index relative to the second relaxation index includes three situations: increase, decrease, and remain unchanged.
[0086] The target relaxation operation is the relaxation operation currently being performed on the target object, and the target relaxation operation can be any one or more relaxation operations of massage relaxation operation, audio relaxation operation, and cooling relaxation operation. When the target relaxation operation is one relaxation operation, the target working parameter is the working parameter corresponding to the one relaxation operation. When the target relaxation operation is multiple relaxation operations, the target working parameter is the working parameter corresponding to the multiple relaxation operations.
[0087] The direction and amount of adjustment of the target working parameter corresponding to the target relaxation operation can be determined according to the change of the first relaxation index relative to the second relaxation index, so as to perform relaxation feedback training on the target object. For example, if the change of the first relaxation index relative to the second relaxation index is increased, it indicates that the target operation has relaxed the target object, and at this time, the working parameter of the target operation can be adjusted in the direction of reducing the relaxation intensity. If the change of the first relaxation index relative to the second relaxation index is decreased or remains unchanged, it indicates that the target operation has not relaxed the target object, and at this time, the working parameter of the target operation can be adjusted in the direction of increasing the relaxation intensity.
[0088] In the above method, by adjusting the working parameters of the target relaxation operation through the change of the first relaxation index relative to the second relaxation index, relaxation feedback adjustment of the target object can be achieved, which can help the target object relax faster and more effectively and maintain mental and physical health.
[0089] In one possible implementation, when the target relaxation operation is an audio relaxation operation, the target working parameters corresponding to the target relaxation operation are adjusted according to the change of the first relaxation index relative to the second relaxation index, including: when the first relaxation index increases relative to the second relaxation index, reducing the volume of the played audio; when the first relaxation index decreases relative to the second relaxation index or remains unchanged, increasing the volume of the played audio.
[0090] When the target relaxation operation is an audio relaxation operation, the target working parameter is the volume. Under the same audio, different volumes have a certain influence on the relaxation intensity of the relaxation operation. Generally, the larger the volume, the greater the relaxation intensity, and the smaller the volume, the smaller the relaxation intensity.
[0091] When the first relaxation index increases relative to the second relaxation index, it indicates that the currently playing audio and the playback volume can have a relaxing effect on the target object. At this time, the working parameters of the target operation can be adjusted in the direction of reducing the relaxation intensity. The smaller the volume, the smaller the relaxation intensity. Therefore, the volume of the playing audio can be reduced appropriately.
[0092] When the first relaxation index decreases or remains unchanged relative to the second relaxation index, it indicates that the currently playing audio or the playback volume cannot relax the target object. At this time, the working parameters of the target operation are adjusted in the direction of increasing the relaxation intensity. The louder the volume, the greater the relaxation intensity. Therefore, the volume of the playing audio can be increased appropriately to relax the target object.
[0093] In some embodiments, each audio may also correspond to a volume threshold range, and the volume of the played audio may be reduced or increased within the volume threshold range. The volume threshold range may be a range determined by the minimum and maximum values of the audio that can play a relaxing role.
[0094] In one possible implementation, after increasing the volume of the played audio when the first relaxation index decreases or remains unchanged relative to the second relaxation index, the method also includes: continuously identifying the relaxation index of the target object; when the relaxation index of the target object continues to decrease or remains unchanged within a preset time period, determining the relaxation level of the current relaxation index; selecting a target audio corresponding to the relaxation level from a pre-stored audio library for playback; the pre-stored audio library includes multiple audios and their corresponding relaxation levels.
[0095] After increasing the volume of the played audio, when the relaxation index of the target object continues to decrease or remains unchanged within the preset time length, that is, the audio played within the preset time length is to reduce the user's stress, indicating that the currently played audio cannot relax the target object. At this time, it is necessary to switch the audio to relax the target object.
[0096] The audio library may be stored in advance in the first electronic device or the second electronic device. The audio library includes a plurality of audios and a state table corresponding to each audio. The state table includes a relaxation level corresponding to each audio.
[0097] In some embodiments, before selecting a target audio corresponding to a relaxation level from a pre-stored audio library for playing, the method further includes: dividing the relaxation index into L levels according to a preset index range; playing multiple audios to the target object; respectively monitoring the relaxation index of the target object in real time during the playing of the multiple audios; and calculating the relaxation level corresponding to each audio according to the respectively monitored relaxation index.
[0098] Calculating the relaxation level corresponding to each audio according to the relaxation index monitored respectively may specifically include: for example, taking the first audio included in the multiple audios as an example: monitoring the relaxation index of the target object during the playing of the first audio; dividing the total duration corresponding to the first audio into s segments, obtaining the relaxation index corresponding to the s segments of audio, calculating the average value of the relaxation index included in each audio segment in the s segments of audio, and obtaining the relaxation level of each audio segment according to the calculated average relaxation index of each audio segment. Adding the duration of each audio segment with the same relaxation level, calculating the proportion of the audio duration corresponding to each relaxation level in the total duration corresponding to the first audio, and obtaining the relaxation level of the first audio according to the proportion of each relaxation level in the first audio.
[0099] Assume that the relaxation index is divided into L levels: low (level 1), relatively low (level 2), medium (level 3), relatively high (level 4), ..., high (level L). According to the relaxation effect of each audio, L levels of low can be obtained for each audio. Assuming that the relaxation effect of each audio is also L levels, the relaxation effect level and the relaxation index level can correspond one to one to obtain the relaxation level of each audio.
[0100] In some embodiments, the state table may also store the audio type, the total number of times it is played, and the effects of the most recent k plays, assuming that the play effects are represented by good or bad.
[0101] The state table of audio 1 is shown in Table 1.
[0102] Table 1
[0103] State table entries name Audio 1 type Instrumental Music Relaxation level medium Total number of plays 13 The effect of the most recent k times good
[0104] Before using the first electronic device or the second electronic device, the target subject needs to select a preferred audio type and collect pulse wave data of the target subject in a quiet state (such as room temperature, soft music with moderate volume) for Q minutes (optionally, Q=10) as the relaxation level as a baseline for model evaluation.
[0105] Then, a random audio is selected for playback. The relaxation index is identified in real time while the audio is being played. After the content is played, the effect of the content is evaluated and the status table is updated.
[0106] The specific steps for evaluating the relaxation index may include:
[0107] In the first step, the audio is divided into s segments, the average relaxation index of each segment is calculated, and the relaxation level corresponding to each segment is obtained according to the average relaxation index of each segment.
[0108] Assuming that the total duration of the audio is p seconds, and each second corresponds to a relaxation index r, we can get p relaxation indexes (r n , n=1, 2, ..., p). Divide the audio into s segments, each segment is t seconds long (if the last segment is less than t seconds long, the last segment starts at the ptth second). Correspondingly, the p relaxation indexes can be divided into s groups, each group includes t relaxation indexes, calculate the average relaxation index in each segment, and obtain the relaxation level of each segment according to the average relaxation index per second. i , assuming that the relaxation index is expressed in percentage, where the most relaxed index is 100, and the relaxation level is 5 levels, then the range of each level is 20, and the relaxation level of each segment is calculated as shown in formula (2).
[0109]
[0110] Where i=1,2,3,......,s
[0111] The second step is to count the proportion of time corresponding to each relaxation level in the total playing time, and determine the level with the largest proportion as the level of the audio.
[0112] In some embodiments, the audio in the preset audio library may also be marked with a relaxation effect, where the relaxation effect is the range of relaxation levels that the song can provide. For example, the relaxation effect is i->L, which means increasing the degree of relaxation from i to L. After determining the relaxation level of the target object, the relaxation range of the relaxation effect may be determined to include audio of the relaxation level of the target object, and any audio that is different from the currently playing audio may be selected as the target audio to be played.
[0113] The steps to calculate the relaxing effect of audio are as follows:
[0114] In the first step, the audio is divided into s segments, the average relaxation index of each segment is calculated, and the relaxation level corresponding to each segment is obtained according to the average relaxation index of each segment. The specific steps are the same as those in the above embodiment and will not be repeated here.
[0115] In the second step, the proportion of the time corresponding to each relaxation level in the total playing time is counted, and the total relaxation effect level 0 of the sleep-aiding content during this playing is calculated based on the proportion, as shown in formula (3).
[0116]
[0117] Among them, w i is the weight of each relaxation level, and its calculation is shown in formula (4).
[0118]
[0119] The earlier the playback time, the smaller the weight, and the later the playback time, the higher the weight. Alternatively, the weight can be set to 1 (i.e., no weight).
[0120] The third step is that when the relaxation index of the target object continues to decrease or remains unchanged within the preset time, according to the level corresponding to the relaxation index (assuming the level is i), find any audio different from the currently playing audio in the state table with a relaxation effect marked as i->L (indicating that the song can increase the relaxation level from i to L) from the audio library and play it as the target audio.
[0121] In some embodiments, priorities corresponding to different relaxation levels can also be set for audios, for example, the relaxation effect of audio A is: relaxation level 1 to relaxation level 3, the relaxation effect of audio B is: relaxation level 1 to relaxation level 5, and the relaxation effect of audio C is: relaxation level 2 to relaxation level 4. For the same relaxation level 2, the priority of audio B is higher than that of audio C, and the priority of audio C is higher than that of audio A. When the relaxation level of the target object is 2, and the currently played audio is audio B, the relaxation range can be determined to include the audios of relaxation level 2 of the target object: audio A and audio C according to the relaxation effect. If the priority of audio C is higher than that of audio A, audio A is determined as the target audio and is played.
[0122] In some embodiments, after the target audio is determined, the volume change rule may be combined to play it to the target object at an appropriate volume.
[0123] In some embodiments, the above-mentioned preset duration can specifically be the duration of the audio. After the target audio is played, the relaxation level in the target audio state table can also be updated according to the recorded relaxation index of the target object when playing the target audio, so as to obtain the actual relaxation level of the target audio based on the target object.
[0124] Step 4: After the playback is finished, the relaxation level in the target audio state table is updated according to the recorded relaxation index of the target object when the target audio is played.
[0125] Step 5. Repeat steps 3 to 4 until the relaxation level of the target object is maintained at level L / 2 or level L for a period of time. The time threshold can be changed by the target object and the default value T is set.
[0126] In one possible implementation, when the above-mentioned target relaxation operation is a cooling relaxation operation, the target working parameters corresponding to the target relaxation operation are adjusted according to the change of the first relaxation index relative to the second relaxation index, including: when the first relaxation index increases relative to the second relaxation index, increasing the temperature within a preset temperature range; when the first relaxation index decreases or remains unchanged relative to the second relaxation index, reducing the temperature within a preset temperature range.
[0127] When the target relaxation operation is a cooling relaxation operation, the target working parameter is temperature. Different temperatures have a certain influence on the relaxation strength of the relaxation operation. Generally, the lower the temperature, the greater the relaxation strength, and the higher the temperature, the smaller the relaxation strength.
[0128] The purpose of the cooling and relaxing operation is to make the target object more comfortable, so the preset temperature range can be the temperature range that the human body feels most comfortable, and an exemplary range can be 18°C to 28°C.
[0129] The purpose of the cooling and relaxing operation is to make the temperature of the space where the target object is located lower than the current temperature. Therefore, in some embodiments, the upper limit value of the preset temperature range may also be the room temperature.
[0130] When the first relaxation index increases relative to the second relaxation index, it indicates that the temperature of the current cooling operation can relax the target object. At this time, the working parameters of the target operation are adjusted in the direction of reducing the relaxation intensity. The closer the temperature is to room temperature, the lower the relaxation intensity of the cooling relaxation operation. Therefore, the temperature can be increased appropriately to relax the target object.
[0131] When the first relaxation index decreases or remains unchanged relative to the second relaxation index, it indicates that the temperature of the current cooling operation cannot relax the target object. At this time, the working parameters of the target operation are adjusted in the direction of increasing the relaxation intensity. The lower the temperature, the lower the relaxation intensity of the cooling relaxation operation. At this time, the temperature can be lowered appropriately to relax the target object.
[0132] In the prior art, the machine learning method first extracts relevant features, and then uses a classifier (support vector machine, Bayesian classifier, etc.) to classify the obtained features to obtain a prediction effect. However, extracting these features requires rich expert experience, and the classification effect also depends to a large extent on the extracted features, which will lead to poor generalization effect. The deep learning method can achieve end-to-end training and prediction, without the need for expert experience, and has high algorithm accuracy. However, the lack of labeled data limits the number of samples that can be used for direct training in deep learning, limiting the upper limit of algorithm performance. Based on the above problems, the present application proposes a method for training a recognition model based on a supervised contrast learning method. This method does not require expert experience and is not limited by the number of labeled data samples.
[0133] In a possible implementation, the relaxation recognition model includes a feature extraction model and a supervised contrast learning model. Before inputting the target pulse wave signal into the pre-trained relaxation recognition model, the method also includes: obtaining multiple sample data; the sample data includes multiple pulse wave signal samples and their corresponding annotation information, and the annotation information is used to characterize the relaxation index corresponding to the pulse wave signal samples; using the feature extraction model to extract coding features for the multiple pulse wave signal samples respectively; inputting the coding features extracted from the multiple pulse wave signal samples and the annotation information corresponding to the multiple pulse wave signal samples into the supervised contrast learning model; in the supervised contrast learning model, for specifying any anchor sample in the multiple pulse wave signal samples, the pulse wave signal sample whose difference between the annotation information and the annotation information of the anchor sample is within a preset difference range is determined as a positive sample; and the feature extraction model is iteratively trained with shortening the distance between the coding features of the positive samples as the goal of the supervised contrast learning loss function.
[0134] The labeling information can be understood as a label of the sample data, and each pulse wave signal sample in the sample data is labeled with a label corresponding to the relaxation index corresponding to the pulse wave signal sample. The labels labeled for different pulse wave signal samples can be the same or different.
[0135] According to the self-supervised contrastive learning method, any anchor sample (i.e., fixed sample) can be specified from multiple pulse wave signal samples, and the specified anchor samples can be multiple. For a certain anchor sample, positive samples and negative samples related to it can be determined.
[0136] As in the above-mentioned embodiment, the feature extraction model uses a feature encoder to extract the coding features in multiple pulse wave signals to obtain the coding features of multiple pulse wave signals. The obtained coding features of the multiple pulse wave signals and the labeling information of the multiple pulse wave signals can be used as the input of the supervised contrast learning model, and any anchor sample is specified in the multiple pulse wave signal samples, and the pulse wave signal sample whose difference between the labeling information and the labeling information of the anchor sample is within a preset difference range is determined as a positive sample; a supervised contrast learning loss function with the goal of shortening the distance between the coding features of the positive samples is obtained, and the feature extraction model can be iteratively trained based on the supervised contrast learning loss function.
[0137] In some embodiments, after obtaining a plurality of sample data, each of the plurality of samples may be preprocessed as in the above embodiment to obtain preprocessed sample data (for example, the sample data after preprocessing is y proc ), perform sample enhancement on the preprocessed sample data to obtain multiple enhanced samples corresponding to each sample.
[0138] For example, the sample enhancement techniques such as empirical mode decomposition (EMD) and noise addition and flipping are used to enhance the sample. The details are as follows:
[0139] 1. In the EMD decomposition stage:
[0140] 1) According to the pre-processed pulse wave signal (y proc ), draw the upper and lower envelope lines, find the mean of the upper and lower envelope lines, and thus draw the mean envelope line of the pulse wave signal.
[0141] 2) The pre-processed pulse wave signal (y proc ) minus the mean envelope to get the intermediate signal y mid .
[0142] 3) Determine y mid Satisfy the two conditions of intrinsic mode functions (IMF). If so, the signal is an IMF component. If not, re-analyze 1) to 3) based on the signal. It usually takes several iterations to obtain IMF components.
[0143] 4) All the IMF components obtained are used as enhanced samples of the pulse wave signal (y IMF ).
[0144] Among them, the intrinsic modal component has two constraints: first, in the entire data segment, the number of extreme points and the number of zero-crossing points must be equal or the difference cannot exceed one. Second, at any time, the average value of the upper envelope formed by the local maximum points and the lower envelope formed by the local minimum points is zero, that is, the upper and lower envelopes are locally symmetric with respect to the time axis.
[0145] 2. In the noise adding stage:
[0146] 1) Obtain a set of random values with the same length as the signal, and obtain the white noise X by normalizing it as in the above formula (1) white .
[0147] 2. The pre-processed pulse wave signal y proc With White Noise X white Add the noise-enhanced data. That is, the enhanced signal y white =y proc +x white .
[0148] 3. In the flipping stage:
[0149] After preprocessing, y proc Perform front-to-back and up-down flipping operations to enhance the data. The signal after front-to-back flipping is y flip , can be obtained by flipping the operator back and forth, that is, y flip = flip(y proc ); signal y after flipping back and forth neg =-(y proc ).
[0150] After the above three stages, multiple enhanced samples can be obtained. Since the enhanced samples are all derived from the pulse wave signal samples, the pulse wave signal samples and their corresponding enhanced samples have the same annotation information.
[0151] Since the enhanced samples are all derived from the pulse wave signal samples, the enhanced samples are equivalent to characterizing the various characteristics of the pulse wave signal samples from different angles. This makes it possible to combine this method of sample enhancement by extracting signal components of different frequency bands with general sample enhancement methods such as noise addition, smoothing, and masking. This can not only effectively retain the physical meaning of the pulse wave signal samples, but also improve the model's anti-noise ability, and can play a more positive role in the training process of the feature extraction model.
[0152] A feature extraction model can be used to extract coding features for multiple pulse wave signal samples and multiple enhanced samples generated respectively, and the coding features of the extracted multiple pulse wave signal samples and the multiple enhanced samples generated and the labeling information corresponding to the multiple pulse wave signal samples and the multiple enhanced samples generated are input into a supervised comparative learning model.
[0153] In the supervised contrastive learning model, the residual network structure (ResNet) is selected as the backbone network. Any anchor sample can be specified among multiple pulse wave signal samples with different relaxation degrees and multiple enhanced samples generated. The enhanced samples and pulse wave signal samples whose difference between their labeling information and that of the anchor samples is within a preset difference range can be determined as positive samples, and the enhanced samples and pulse wave signal samples whose difference between their labeling information and that of the anchor samples is outside the preset difference range can be determined as negative samples.
[0154] Exemplarily, assuming that the relaxation index of the anchor sample is M and the preset range is ±N, the pulse wave signal and its enhanced sample whose relaxation index is within the absolute value range |M±N| are determined as positive samples, and the pulse wave signal and its enhanced sample whose relaxation index is outside the absolute value range |MN| are determined as negative samples. Optionally, M is an arbitrary relaxation index, and N can be selected as 10.
[0155] A supervised contrastive learning loss function is determined with the goal of narrowing the distance between the encoding features of the positive samples, and the feature extraction model is iteratively trained based on the supervised contrastive learning loss function.
[0156] Based on the goal of the self-supervised contrastive regression learning loss function, illustratively, in the embodiment of the present application, a loss function of self-supervised contrastive learning can be defined as:
[0157]
[0158] Among them, L self is the loss function corresponding to the i-th anchor sample used in this round of iterative training, I is the total number of samples used in this round of iterative training, P(i) is all positive samples corresponding to the i-th anchor sample, r i is the encoding feature of the i-th anchor sample, is the encoding feature of the pth positive sample corresponding to the ith anchor sample, Sim() is the similarity calculation function, A(i) is all other pulse wave signal samples and enhanced samples except the ith anchor sample, is the encoded feature of the a-th sample among all samples except the i-th anchor sample, and τ is the temperature hyperparameter.
[0159] Located on the molecule The distance between the encoding features of the positive samples can be continuously narrowed, and the This can make the distribution of the coding features of samples with different labeled information more uniform, so that the coding features of samples with different labeled information can retain more useful information as much as possible.
[0160] In some embodiments, after iterative training of the feature extraction model, features can be extracted from multiple acquired pulse wave signal samples and corresponding enhanced samples based on the trained feature extraction model; the extracted features and corresponding annotation information are input into the supervised contrastive learning model to train the supervised contrastive learning model. The trained feature extraction model and the supervised contrastive learning model are combined to obtain a relaxation degree recognition model.
[0161] In the above method, a new self-supervised contrast loss function is used to allow each anchor point to have multiple positive samples and allow positive samples to have a certain threshold range. The feature encoder and the supervised contrast regression learning model are combined together, and the feature extraction model is iteratively trained based on the self-supervised contrast regression learning loss function, which can improve the feature extraction performance of the feature extraction model, thereby enabling the trained feature extraction model to more accurately extract features from the pulse wave signal and improve the accuracy of the relaxation recognition model. And by setting the goal of the supervised contrast regression learning loss function to shorten the distance between the encoding features of the positive samples, the model optimization goal can be set for the two combined models, which can further improve the accuracy of model recognition.
[0162] In summary, in this application, the pulse wave signal of the target object is obtained, and the relaxation index corresponding to the pulse wave signal is identified based on the relaxation recognition model pre-trained by the supervised contrast learning method. Since the pulse wave can be directly analyzed to obtain the relaxation index, the method can be run on a portable relaxation detection device and a wearable device (such as a smart watch, a ring, etc.), which provides a good choice for intelligent prediction of relaxation state. The supervised contrast learning method can iteratively train the relaxation recognition model, and can improve the accuracy of the relaxation recognition model. In the above method, performing a target relaxation operation based on the relaxation index can help the target object reduce stress, and improving the relaxation index of the target object means that the target object is in a relaxed state, which can improve the user experience of the target object. By dividing the target pulse wave signal into N signal segments and obtaining the relaxation index of the N signal segments, the target object can be more clearly understood The specific values corresponding to the relaxation index in different segments, combined with the relaxation index of the N signal segments, the changing trend of the relaxation index can be understood. And the working parameters of the target relaxation operation can be adjusted based on the change trend of the relaxation index, and relaxation feedback adjustment can be achieved for the target object, which can help the target object relax faster and more effectively and maintain mental and physical health. Through a new self-supervised contrast loss function, each anchor point is allowed to have multiple positive samples, and the positive samples are allowed to have a certain threshold range. The feature encoder and the supervised contrast regression learning model are combined together, and the feature extraction model is iteratively trained based on the self-supervised contrast regression learning loss function, which can improve the feature extraction performance of the feature extraction model, so that the trained feature extraction model can more accurately extract features from the pulse wave signal and improve the accuracy of the relaxation recognition model. And by setting the goal of the supervised contrast regression learning loss function to shorten the distance between the encoding features of the positive samples, the model optimization goal can be set for the two combined models, which can further improve the accuracy of model recognition.
[0163] Figure 3 It is a structural schematic diagram of a relaxation degree identification device provided in an embodiment of the present application.
[0164] For example, Figure 3 As shown, the device 300 includes:
[0165] The acquisition module 301 is used to acquire the pulse wave signal of the target object;
[0166] A preprocessing module 302 is used to preprocess the pulse wave signal to obtain a target pulse wave signal;
[0167] The recognition module 303 is used to input the target pulse wave signal into a pre-trained relaxation recognition model to obtain a relaxation index corresponding to the target pulse wave signal; the relaxation recognition model is trained based on a supervised contrast learning method.
[0168] Optionally, the device further includes: a relaxation module, configured to perform a target relaxation operation based on the relaxation index to relax the target object when the relaxation index is less than a preset threshold.
[0169] In one possible implementation, the relaxation recognition model includes a feature extraction model and a supervised contrast learning model. The recognition module 303 is specifically used to extract and process N signal segments from the target pulse wave signal in preset units through the feature extraction model to obtain a feature map containing N signal segments; where N is greater than or equal to 1; and analyze and compare the feature map through the supervised contrast learning model to obtain the relaxation index of the N signal segments.
[0170] Optionally, the device also includes: an adjustment module, which is used for, when the N signal segments include the current signal segment and the previous signal segment, the relaxation index corresponding to the current signal segment is the first relaxation index, and the relaxation index corresponding to the previous signal segment is the second relaxation index; according to the change of the first relaxation index relative to the second relaxation index, adjusting the target working parameter corresponding to the target relaxation operation; wherein, when the target relaxation operation is an audio relaxation operation, the target working parameter is volume; when the target relaxation operation is a cooling relaxation operation, the target working parameter is temperature.
[0171] In one possible implementation, when the target relaxation operation is an audio relaxation operation, the adjustment module is specifically used to reduce the volume of the played audio when the first relaxation index increases relative to the second relaxation index; when the first relaxation index decreases or remains unchanged relative to the second relaxation index, increase the volume of the played audio.
[0172] Optionally, the device also includes: a switching module, used to continuously identify the relaxation index of the target object after increasing the volume of the played audio when the first relaxation index decreases or remains unchanged relative to the second relaxation index; determine the relaxation level of the current relaxation index when the relaxation of the target object continues to decrease or remains unchanged within a preset time period; select the target audio corresponding to the relaxation level from a pre-stored audio library for playback; the pre-stored audio library includes multiple audios and their corresponding relaxation levels.
[0173] In one possible implementation, when the target relaxation operation is a cooling relaxation operation, the adjustment module is specifically used to increase the temperature within a preset temperature range when the first relaxation index increases relative to the second relaxation index; and to reduce the temperature within a preset temperature range when the first relaxation index decreases relative to the second relaxation index or remains unchanged.
[0174] In a possible implementation, the device is a first electronic device, and the relaxation module is specifically used to detect a second electronic device connected to the first electronic device; when it is detected that the first electronic device is connected to the second electronic device, the second electronic device is controlled to perform a target relaxation operation based on the relaxation index; when it is not detected that the first electronic device is not connected to the second electronic device, a connection is established between the first electronic device and the second electronic device, and after the connection, the second electronic device is controlled to perform the target relaxation operation based on the relaxation index.
[0175] Optionally, the device also includes: a model training module, used to obtain multiple sample data; the sample data includes multiple pulse wave signal samples and their corresponding annotation information, the annotation information is used to characterize the relaxation index corresponding to the pulse wave signal sample; using a feature extraction model to extract coding features for the multiple pulse wave signal samples respectively; the coding features extracted from the multiple pulse wave signal samples and the annotation information corresponding to the multiple pulse wave signal samples are input into a supervised contrast learning model; in the supervised contrast learning model, for specifying any anchor sample among the multiple pulse wave signal samples, the pulse wave signal sample whose difference between the annotation information and the annotation information of the anchor sample is within a preset difference range is determined as a positive sample; and the feature extraction model is iteratively trained with shortening the distance between the coding features of the positive samples as the goal of the supervised contrast learning loss function.
[0176] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0177] For example, Figure 4 As shown, the electronic device 400 includes: a memory 401 and a processor 402, wherein the memory 401 stores an executable program code 4011, and the processor 402 is used to call and execute the executable program code 4011 to perform a method for identifying relaxation.
[0178] In this embodiment, the electronic device can be divided into functional modules according to the above method example. For example, each functional module can be corresponded to, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0179] In the case of dividing each functional module according to each function, the electronic device may include: an acquisition module, a preprocessing module, an identification module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0180] The electronic device provided in this embodiment is used to execute the above-mentioned method for identifying relaxation degree, and thus can achieve the same effect as the above-mentioned implementation method.
[0181] In the case of an integrated unit, the electronic device may include a processing module and a storage module. The processing module may be used to control and manage the actions of the electronic device. The storage module may be used to support the electronic device in executing mutual program codes and data.
[0182] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits disclosed in the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.
[0183] This embodiment also provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is executed on a computer, the computer executes the above-mentioned related method steps to implement a method for identifying relaxation degree in the above-mentioned embodiment.
[0184] This embodiment also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement a method for identifying relaxation degree in the above-mentioned embodiment.
[0185] In addition, the electronic device provided in the embodiments of the present application may specifically be a chip, a component or a module, and the electronic device may include a connected processor and a memory; wherein the memory is used to store instructions, and when the electronic device is running, the processor may call and execute instructions so that the chip executes a method for identifying relaxation in the above-mentioned embodiments.
[0186] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0187] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0188] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0189] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for identifying relaxation, characterized in that: The method comprises: collecting a pulse wave signal of a target object; Preprocessing the pulse wave signal to obtain a target pulse wave signal; The target pulse wave signal is input into a pre-trained relaxation recognition model to obtain a relaxation index corresponding to the target pulse wave signal; the relaxation recognition model is trained based on a supervised contrast learning method.
2. The method according to claim 1, characterized in that After obtaining the relaxation index corresponding to the target pulse wave signal, the method further includes: Determining whether the relaxation index is less than a preset threshold; When the relaxation index is less than the preset threshold, a target relaxation operation is performed based on the relaxation index to relax the target object.
3. The method according to claim 2, characterized in that The relaxation recognition model includes a feature extraction model and a supervised contrast learning model. The target pulse wave signal is input into a pre-trained relaxation recognition model to obtain a relaxation index corresponding to the target pulse wave signal, including: Extracting N signal segments from the target pulse wave signal in preset units by the feature extraction model and processing them to obtain a feature graph containing the N signal segments; wherein N is greater than or equal to 1; The characteristic graphs are analyzed and compared by the supervised contrast learning model to obtain the relaxation indexes of the N signal segments.
4. The method according to claim 3, characterized in that: When the N signal segments include a current signal segment and a previous signal segment of the previous signal segment, the relaxation index corresponding to the current signal segment is a first relaxation index, and the relaxation index corresponding to the previous signal segment is a second relaxation index; After performing the target relaxation operation based on the relaxation index, the method further includes: adjusting a target working parameter corresponding to the target relaxation operation according to a change in the first relaxation index relative to the second relaxation index; Wherein, when the target relaxation operation is an audio relaxation operation, the target working parameter is volume; When the target relaxation operation is a cooling relaxation operation, the target operating parameter is temperature.
5. The method according to claim 4, characterized in that When the target relaxation operation is an audio relaxation operation, adjusting the target working parameter corresponding to the target relaxation operation according to the change of the first relaxation index relative to the second relaxation index includes: When the first relaxation index increases relative to the second relaxation index, reducing the volume of the played audio; When the first relaxation index decreases or remains unchanged relative to the second relaxation index, the volume of the played audio is increased.
6. The method according to claim 5, characterized in that After increasing the volume of the played audio when the first relaxation index decreases or remains unchanged relative to the second relaxation index, the method further includes: continuously identifying a relaxation index of the target subject; When the relaxation degree of the target object continues to decrease or remains unchanged within a preset time period, determining a relaxation level of a current relaxation degree index; A target audio corresponding to the relaxation level is selected from a pre-stored audio library for playing; the pre-stored audio library includes a plurality of audios and their corresponding relaxation levels.
7. The method according to claim 4, characterized in that When the target relaxation operation is a cooling relaxation operation, adjusting the target working parameter corresponding to the target relaxation operation according to the change of the first relaxation index relative to the second relaxation index includes: When the first relaxation index increases relative to the second relaxation index, increasing the temperature within a preset temperature range; When the first relaxation index decreases or remains unchanged relative to the second relaxation index, the temperature is decreased within the preset temperature range.
8. The method according to claim 2, characterized in that: The method is applied to a first electronic device, and performing a target relaxation operation based on the relaxation index includes: Detecting a second electronic device connected to the first electronic device; When it is detected that the first electronic device is connected to the second electronic device, controlling the second electronic device to perform a target relaxation operation based on the relaxation index; When it is not detected that the first electronic device is not connected to the second electronic device, a connection is established between the first electronic device and the second electronic device, and after the connection, the second electronic device is controlled to perform a target relaxation operation based on the relaxation index.
9. The method according to any one of claims 1 to 8, characterized in that: The relaxation degree recognition model includes a feature extraction model and a supervised contrast learning model. Before inputting the target pulse wave signal into the pre-trained relaxation degree recognition model, the method further includes: Acquire a plurality of sample data; the sample data includes a plurality of pulse wave signal samples and their corresponding annotation information, the annotation information is used to characterize the relaxation index corresponding to the pulse wave signal samples; Using the feature extraction model to extract coding features for the plurality of pulse wave signal samples respectively; Inputting the encoded features extracted from the plurality of pulse wave signal samples and the labeling information corresponding to the plurality of pulse wave signal samples into a supervised contrastive learning model; In the supervised contrastive learning model, for any anchor sample specified in the plurality of pulse wave signal samples, a pulse wave signal sample whose difference between its labeling information and the labeling information of the anchor sample is within a preset difference range is determined as a positive sample; The feature extraction model is iteratively trained by taking shortening the distance between the encoding features of the positive samples as the goal of the supervised contrastive learning loss function.
10. A device for identifying relaxation, characterized in that: The device comprises: An acquisition module, used for acquiring a pulse wave signal of a target object; A preprocessing module, used for preprocessing the pulse wave signal to obtain a target pulse wave signal; The recognition module is used to input the target pulse wave signal into a pre-trained relaxation recognition model to obtain a relaxation index corresponding to the target pulse wave signal; the relaxation recognition model is trained based on a supervised contrast learning method.
11. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable program codes; A processor, configured to call and run the executable program code from the memory, so that the electronic device executes the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Emotion regulating device and method thereof
CN101822863A
Device and method for relieving stress of examinees in examination rooms
CN108095742A
Intelligent feedback pressure reduction massage relaxing equipment
CN111529303A
Music recommendation method, device and equipment based on wearable equipment and storage medium
CN115795085A
Relax guiding device and biofeedback guiding device
CN1199347A