Aromatherapy sleep-aiding control method and system based on virtual reality equipment
By combining optical sensors and aromatherapy equipment in virtual reality devices, using random forest learning models to predict user emotions, and adaptively adjusting aromatherapy output and scenes, the problem in the existing technology that virtual reality devices cannot be adaptively adjusted is solved, and the sleep aid is improved. experience and efficiency.
Patent Information
- Application Number
- CN202410798579.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-09-10
AI Technical Summary
Existing virtual reality devices cannot adaptively adjust VR video content, resulting in poor user experience and low sleep aid efficiency.
By embedding optical sensors and aromatherapy devices in virtual reality devices, the random forest learning model is used to predict user emotions, and the aromatherapy output and playback scenes are adjusted based on heart rate data to achieve adaptive sleep aid control.
It improves the user's sleep aid experience and efficiency, and provides personalized sleep aid solutions by adjusting aromatherapy and scenes in real time.
Smart Images

Figure CN118615554A
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of device control, and in particular, relates to an aromatherapy sleep-aiding control method and system based on virtual reality equipment. Background Art
[0002] With the accelerated pace of modern society and many other factors such as life pressure, people's sleep quality is generally poor and even insomnia often occurs. The quality of sleep can directly affect physical health. There are many ways to help sleep on the market, such as using virtual reality devices to output immersive VR video content to achieve the effect of physical assistance to help sleep, or using some smells to stimulate the body's physiological states to achieve a sleep-aiding effect, so that people can get a higher quality sleep.
[0003] However, existing virtual reality devices mainly rely on manual control of VR video content and are unable to achieve adaptive adjustment, which not only affects the user's device experience but also easily leads to low sleep-aiding efficiency. Summary of the invention
[0004] This application aims to solve the technical defects that the existing virtual reality devices mentioned above mainly control the VR video content manually and cannot achieve adaptive adjustment, which not only affects the user's device experience but also easily leads to low sleep-aiding efficiency. A method and system for aromatherapy sleep-aiding control based on virtual reality devices are proposed, and the technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides an aromatherapy sleep-aiding control method based on a virtual reality device, the method is applied to the virtual reality device, an optical sensor is embedded inside the frame of the virtual reality device, and an aromatherapy device is arranged at the nose pad of the virtual reality device, and the method includes:
[0006] After receiving the user's control instruction, acquiring at least two frames of heart rate detection signals based on the optical sensor according to a preset sampling frequency;
[0007] Process each frame of the heart rate detection signal to obtain corresponding heart rate data, and determine an aromatherapy control signal based on all the heart rate data and a preset heart rate threshold, so that the aromatherapy device performs output processing according to the aromatherapy control signal;
[0008] Extracting at least two heart rate features from all heart rate detection signals and all heart rate data, and inputting all heart rate features into a preset random forest learning model to predict user emotions; wherein the preset random forest learning model is trained by at least two emotion labels and at least two heart rate feature samples corresponding to each user emotion label;
[0009] The playback scene corresponding to the user's emotion is queried in a preset emotion-scene mapping list, and the playback scene is displayed on a virtual reality device; wherein the preset emotion-scene mapping list includes at least two defined emotions and a playback scene corresponding to each defined emotion.
[0010] In an optional solution of the first aspect, processing each frame of the heart rate detection signal to obtain corresponding heart rate data includes:
[0011] Based on the heart rate data of the n-1th frame of the heart rate detection signal and a preset heart rate error, a minimum peak interval of the nth frame of the heart rate detection signal is obtained; wherein n is a positive integer greater than 1;
[0012] Determine at least two first peaks in the nth frame heart rate detection signal according to the minimum peak interval, and obtain a peak threshold according to the minimum first peak among all the first peaks;
[0013] Based on a preset peak interval and a peak threshold, at least two second peaks are determined in the nth frame of the heart rate detection signal; wherein each second peak is greater than the peak threshold;
[0014] The peak interval between any two adjacent second peak values is calculated, and the heart rate data corresponding to the n-th frame heart rate detection signal is obtained according to the first average value of all the peak intervals.
[0015] In another optional solution of the first aspect, obtaining the heart rate data corresponding to the n-th frame heart rate detection signal according to the first average value of all peak intervals includes:
[0016] Obtaining first heart rate data according to a first average value of all peak intervals, and determining a heartbeat interval of the n-th frame heart rate detection signal based on the first heart rate data;
[0017] When it is detected that the difference between any peak interval and the heartbeat interval is in a preset first difference interval, the latter second peak value of the two second peak values corresponding to the peak interval is removed;
[0018] The second heart rate data is obtained according to all the second peak values after the elimination process, and the second heart rate data is used as the heart rate data corresponding to the n-th frame heart rate detection signal.
[0019] In another optional solution of the first aspect, obtaining the second heart rate data according to all the second peak values after elimination includes:
[0020] When the difference between any peak interval and the heartbeat interval is detected in all the second peaks after the elimination process, and is within the preset second difference interval, the number of missed detections is calculated according to the peak interval and the heartbeat interval;
[0021] Screening out a portion of the heart rate detection signal between two second peaks corresponding to the peak interval in the nth frame heart rate detection signal, and determining at least one third peak corresponding to the number of missed detections in the portion of the heart rate detection signal;
[0022] All third peak values are updated to all second peak values after elimination, and second heart rate data are obtained according to all second peak values after update.
[0023] In another optional solution of the first aspect, determining the aromatherapy control signal according to all the heart rate data and a preset heart rate threshold includes:
[0024] Calculate the difference between each heart rate data and the preset heart rate threshold respectively, and obtain the difference control signal according to all the differences and the preset control parameters;
[0025] The difference control signal is converted and processed to obtain a servo control angle, and the servo control angle is used as an aromatherapy control signal; wherein the aromatherapy device includes an aromatherapy box and a servo arranged on a cover of the aromatherapy box, so that the opening and closing state of the cover of the aromatherapy box can be controlled by adjusting the control angle of the servo.
[0026] In yet another optional solution of the first aspect, at least two heart rate features are extracted from all heart rate detection signals and all heart rate data, including:
[0027] Calculating a second mean of all peak intervals corresponding to all heart rate detection signals, and obtaining a heart rate variability feature according to the second mean;
[0028] Calculate the third mean, standard deviation, maximum value and minimum value corresponding to all heart rate data, and use the third mean, standard deviation, maximum value and minimum value as heart rate statistical features;
[0029] Fourier transform processing is performed on all heart rate detection signals to obtain heart rate frequency domain features, and heart rate variability features, heart rate statistical features and heart rate frequency domain features are used as at least two heart rate features.
[0030] In another optional solution of the first aspect, after displaying the playback scene on the virtual reality device, the method further includes:
[0031] When the playback scene is the first scene, the preset scene sound effect is turned down, and the preset scene sound effect after the turning down is played;
[0032] When the playing scene is the second scene, the preset scene sound effect and the white noise are superimposed, and the preset scene sound effect after the superimposition processing is played.
[0033] In a second aspect, an embodiment of the present application provides an aromatherapy sleep aid control system based on a virtual reality device. The system is applied to the virtual reality device. An optical sensor is embedded inside the frame of the virtual reality device. An aromatherapy device is provided at the nose pad of the virtual reality device. The system includes:
[0034] A signal detection module, configured to obtain at least two frames of heart rate detection signals based on an optical sensor at a preset sampling frequency after receiving a control instruction from a user;
[0035] The aromatherapy control module is used to process each frame of the heart rate detection signal to obtain corresponding heart rate data, and determine the aromatherapy control signal according to all the heart rate data and a preset heart rate threshold, so that the aromatherapy device performs output processing according to the aromatherapy control signal;
[0036] An emotion prediction module, used to extract at least two heart rate features from all heart rate detection signals and all heart rate data, and input all heart rate features into a preset random forest learning model to predict user emotions; wherein the preset random forest learning model is trained by at least two emotion labels and at least two heart rate feature samples corresponding to each user emotion label;
[0037] The scene display module is used to query the playback scene corresponding to the user's emotion in the preset emotion-scene mapping list and display the playback scene on the virtual reality device; wherein the preset emotion-scene mapping list includes at least two defined emotions and the playback scene corresponding to each defined emotion.
[0038] In a third aspect, the embodiment of the present application further provides an aromatherapy sleep aid control system based on a virtual reality device, including a processor and a memory;
[0039] The processor is connected to the memory;
[0040] A memory for storing executable program codes;
[0041] The processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the aromatherapy sleep-aiding control method based on the virtual reality device provided by the first aspect of the embodiment of the present application or any one of the implementation methods of the first aspect.
[0042] In a fourth aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the aromatherapy sleep aid control method based on a virtual reality device provided by the first aspect of the embodiment of the present application or any one of the implementation methods of the first aspect can be implemented.
[0043] In an embodiment of the present application, when aromatherapy is used to aid sleep based on a virtual reality device, after receiving a control instruction from the user, at least two frames of heart rate detection signals are acquired based on an optical sensor at a preset sampling frequency; each frame of the heart rate detection signal is processed to obtain corresponding heart rate data, and an aromatherapy control signal is determined based on all the heart rate data and a preset heart rate threshold, so that the aromatherapy device performs output processing according to the aromatherapy control signal; at least two heart rate features are extracted from all the heart rate detection signals and all the heart rate data, and all the heart rate features are input into a preset random forest learning model to predict the user's emotions; the playback scene corresponding to the user's emotions is queried in a preset emotion-scene mapping list, and the playback scene is displayed on the virtual reality device. An optical sensor arranged on the virtual reality device collects multi-frame heart rate detection signals in real time, and generates an aromatherapy control signal that can control the aromatherapy device to output aromatherapy according to the heart rate data obtained from all the heart rate detection signals and a preset heart rate threshold. At the same time, the user's current emotion can be predicted according to all the heart rate detection signals, the heart rate characteristics corresponding to all the heart rate data, and a preset random forest learning model, so as to play the playback scene corresponding to the current emotion on the virtual reality device. Not only can the type of scene played be adjusted in time according to the real-time predicted user emotion to achieve adaptive adjustment, but the virtual playback scene and aromatherapy output can also be used as a common sleep-aiding method to effectively ensure the user's sleep-aiding experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0045] Figure 1 An overall flow chart of an aromatherapy sleep-aiding control method based on a virtual reality device provided in an embodiment of the present application;
[0046] Figure 2 A schematic diagram of the structure of an aromatherapy sleep-aiding control system based on a virtual reality device provided in an embodiment of the present application;
[0047] Figure 3 A schematic diagram of the structure of another aromatherapy sleep-aiding control system based on a virtual reality device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0049] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application, and different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments recorded. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, although the embodiment may not be clearly recorded in the following text.
[0050] The following description provides examples and does not limit the scope, applicability or examples set forth in the claims. Changes may be made to the functions and arrangements of the elements described without departing from the scope of the present application. Various processes or components may be appropriately omitted, substituted or added to each example. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted or combined. In addition, features described in some examples may be combined in other examples.
[0051] See also Figure 1 , Figure 1 An overall flow chart of an aromatherapy sleep-aiding control method based on a virtual reality device provided in an embodiment of the present application is shown.
[0052] like Figure 1 As shown, the aromatherapy sleep-aiding control method based on virtual reality equipment may at least include the following steps:
[0053] Step 102: After receiving the user's control instruction, obtain at least two frames of heart rate detection signals based on the optical sensor according to a preset sampling frequency.
[0054] In the embodiment of the present application, the aromatherapy sleep-aiding control method based on the virtual reality device can be applied to, but not limited to, a control terminal. The control terminal can be set in the virtual reality device to analyze and process the user's heart rate detection signal collected in real time, and control the aromatherapy device to output aromatherapy to the user according to the processing result, and control the virtual reality device to display the playback scene for sleep-aiding to the user, that is, to combine aromatherapy and virtual playback scene to jointly ensure the sleep-aiding effect of the user. Among them, the virtual reality device can be, but not limited to, a device such as VR glasses for users to wear. In addition to providing users with interactive scenes and other needs, it can also collect the user's heart rate detection signal in real time through the optical sensor embedded in the inner side of the frame when the user needs sleep-aiding. Here, the optical sensor can contact the user's forehead when the user wears the virtual reality device. It can be composed of a light-emitting diode and a photodetector. The light-emitting diode emits light to the user's skin, and receives the light signal absorbed and reflected by the skin and blood vessels. The photodetector converts the received light signal into an electrical signal, and then enhances the signal strength through an amplifier, and removes high-frequency noise and other interference through a filter to retain the important information of the heart rate detection signal. It can be understood that the ESP32 module (the ESP32 module is embedded in the virtual reality device through PCB and flexible cable) can be used as a communication method to realize signal transmission between the optical sensor and the control terminal, that is, after the optical sensor collects the user's heart rate detection signal, the heart rate detection signal can be sent to the ESP32 module, and the ESP32 module transmits the packaged heart rate detection signal to the control terminal through the wireless network, and is not limited to this.
[0055] Among them, the nose pad of the virtual reality device is also provided with an aromatherapy device, which can be specifically composed of a microcontroller, an aromatherapy box, and a servo arranged on the cover of the aromatherapy box. The microcontroller can, but is not limited to, obtain the aromatherapy control signal sent by the control terminal through a wireless network, and send a corresponding pulse width modulation signal to the servo according to the aromatherapy control signal to adjust the rotation angle of the servo, thereby adjusting the opening and closing state of the cover of the aromatherapy box (for example, when the rotation angle of the servo is 10 degrees, the opening and closing angle of the cover of the corresponding aromatherapy box is 10 degrees). It can be understood that the automatic control program set in the microcontroller of the aromatherapy device can be a technical means well known in the art, and the microcontroller and the control terminal can also use ESP32 module as a communication method to realize signal transmission, and it is not limited to this.
[0056] It can also be understood that the control terminal can specifically collect multiple frames of heart rate detection signals in real time through an optical sensor arranged on the virtual reality device, so as to generate an aromatherapy control signal that can control the aromatherapy device to output aromatherapy according to the heart rate data obtained from all the heart rate detection signals and the preset heart rate threshold; at the same time, the user's current emotion can also be predicted according to all heart rate detection signals, the heart rate characteristics corresponding to all heart rate data, and the preset random forest learning model, so as to play the playback scene corresponding to the current emotion on the virtual reality device, which can not only timely adjust the type of scene played according to the real-time predicted user emotion to achieve adaptive adjustment, but also use the virtual playback scene and aromatherapy output as a common sleep-aiding method to effectively ensure the user's sleep-aiding experience.
[0057] Specifically, when aromatherapy is used to aid sleep based on a virtual reality device, the user can select control instructions that meet the needs after wearing the virtual reality device, such as but not limited to interactive instructions, playback instructions, or sleep-aiding instructions, and when the control terminal detects that the user has selected a sleep-aiding control instruction, it can send a data detection request to the photoelectric sensor, so that the photoelectric sensor collects multiple frames of heart rate detection signals according to a preset sampling frequency, and can feed back the collected multiple frames of heart rate detection signals to the control terminal in real time. It is understandable that after the control terminal detects that the user has selected a sleep-aiding instruction, it can also, but is not limited to, first show the user a playback scene that represents a relaxed and pleasant experience, such as a beach, a park, or a beautiful garden, so as to bring a certain degree of comfort to the user's current emotions through the playback scene in advance, which is conducive to a higher sleep-aiding effect in the future, and the playback scene can also be automatically adjusted according to the actual predicted current emotions of the user, but is not limited to this.
[0058] Step 104: Process each frame of the heart rate detection signal to obtain corresponding heart rate data, and determine an aromatherapy control signal based on all the heart rate data and a preset heart rate threshold, so that the aromatherapy device performs output processing according to the aromatherapy control signal.
[0059] Specifically, after acquiring multiple frames of heart rate detection signals, the control terminal may, but is not limited to, analyze and process each frame of the heart rate detection signal to obtain multiple peaks corresponding to each frame of the heart rate detection signal, and calculate the heart rate data corresponding to each frame of the heart rate detection signal based on the average result corresponding to the peak intervals between all two adjacent peaks. Here, the heart rate data corresponding to each frame of the heart rate detection signal may, but is not limited to, refer to the following:
[0060]
[0061] In the above formula, HR i It can correspond to the heart rate data of the nth frame heart rate detection signal, RR iIt may correspond to the mean value result corresponding to the peak intervals between all two adjacent peaks in the nth frame heart rate detection signal. Of course, in the embodiment of the present application, the time window and moving average method may also be used to calculate the heart rate data corresponding to each frame of the heart rate detection signal, which is not limited thereto.
[0062] Furthermore, after obtaining the heart rate data corresponding to each frame of the heart rate detection signal, the control terminal can also calculate the difference between each heart rate data and the preset heart rate threshold, and can use the PID controller and the preset control parameters to process all the differences to obtain the difference control signal. Here, when the difference control signal is obtained, the control terminal can calculate the proportional control signal through the following formula and all the differences:
[0063] P out =K p ·e(t)
[0064] In the above formula, P out Can be a proportional control signal, K p It can be a proportional gain parameter in the preset control parameters, and e(t) can be a difference function obtained according to all the differences.
[0065] In addition, the control terminal can also calculate the integral control signal through the following formula and all the differences:
[0066]
[0067] In the above formula, I out Can be the integral control signal, K i It can be the integral gain parameter in the preset control parameters. It can be the integral term corresponding to the cumulative sum of all differences.
[0068] In addition, the control terminal can also calculate the differential control signal through the following formula and all the differences:
[0069]
[0070] In the above formula, D out Can be a differential control signal, K d It can be the differential gain parameter in the preset control parameters. It can be the differential term corresponding to the rate of change of all differences.
[0071] Further, after respectively obtaining the proportional control signal, the integral control signal and the differential control signal, the control terminal may sum the proportional control signal, the integral control signal and the differential control signal to obtain the difference control signal, and convert the difference control signal to calculate the steering control angle for adjusting the steering gear. Here, when converting the difference control signal, it is possible but not limited to using a preset conversion list to find out the steering control angle corresponding to the difference control signal. The preset conversion list may be obtained manually by analyzing historical control signals and historical control angles, and may include multiple control angles and control signals corresponding to each control angle, or may include control angles and conversion functions corresponding to control signals, and is not limited thereto.
[0072] Furthermore, after determining the servo control angle, the control terminal can also use the servo control angle as an aromatherapy control signal and send it to the aromatherapy device, so that the microcontroller of the aromatherapy device can control the rotation angle of the servo to be consistent with the servo control angle after parsing the aromatherapy control signal, and then adjust the opening and closing state of the aromatherapy box lid to achieve the output of aromatherapy. It can be understood that since the aromatherapy device is set at the nose pad of the virtual reality device, when the opening and closing angle of the aromatherapy box lid is greater than 0, the aroma in the aromatherapy box can be emitted to stimulate the user, and the larger the opening and closing angle of the aromatherapy box lid, the higher the concentration of the emitted aromatherapy.
[0073] Of course, in the embodiment of the present application, the control terminal can also send all the determined heart rate data to the aromatherapy device, so that the microcontroller of the aromatherapy device uses the PID controller and preset control parameters to process the difference between all the heart rate data and the preset heart rate threshold to obtain a difference control signal and convert it into a corresponding servo control angle, and it is not limited to this.
[0074] As an option of the embodiment of the present application, each frame of the heart rate detection signal is processed to obtain corresponding heart rate data, including:
[0075] Based on the heart rate data of the n-1th frame of the heart rate detection signal and a preset heart rate error, a minimum peak interval of the nth frame of the heart rate detection signal is obtained; wherein n is a positive integer greater than 1;
[0076] Determine at least two first peaks in the nth frame heart rate detection signal according to the minimum peak interval, and obtain a peak threshold according to the minimum first peak among all the first peaks;
[0077] Based on a preset peak interval and a peak threshold, at least two second peaks are determined in the nth frame of the heart rate detection signal; wherein each second peak is greater than the peak threshold;
[0078] The peak interval between any two adjacent second peak values is calculated, and the heart rate data corresponding to the n-th frame heart rate detection signal is obtained according to the first average value of all the peak intervals.
[0079] In order to ensure the accuracy of the heart rate data, when the control terminal processes each frame of the heart rate detection signal to obtain the corresponding heart rate data, the heart rate range of the n-th frame of the heart rate detection signal can be obtained based on the heart rate data of the n-1-th frame of the heart rate detection signal and the preset heart rate error. For example, the heart rate data of the n-1-th frame of the heart rate detection signal is Taking the preset heart rate error of ±5 beats / minute as an example, the heart rate range of the nth frame heart rate detection signal can be expressed as The maximum value of the heart rate range can be substituted into the preset minimum peak interval expression to calculate the minimum peak interval of the nth frame heart rate detection signal. Here, the preset minimum peak interval expression can be but is not limited to the following:
[0080]
[0081] In the above formula, RRI min It can correspond to the minimum peak interval of the heart rate detection signal of the nth frame. It may correspond to the maximum value of the heart rate range of the nth frame heart rate detection signal.
[0082] It should be noted that n in the embodiment of the present application is a positive integer greater than 1, that is, starting from the second frame heart rate detection signal, the corresponding minimum peak interval can be determined in the manner mentioned above, and when the first frame heart rate detection signal is processed to obtain the corresponding minimum peak interval, the heart rate range of the first frame heart rate detection signal can be obtained based on but not limited to the preset heart rate data and the preset heart rate error, and is not limited to this.
[0083] Next, after determining the minimum peak interval of the heart rate detection signal of the nth frame, the control terminal can divide and process the heart rate detection signal of the nth frame according to the minimum peak interval to obtain multiple heart rate detection signal segments corresponding to the minimum peak interval, and can identify the corresponding first peak value (that is, the value corresponding to at least one peak in the heart rate detection signal segment) in each heart rate detection signal segment to obtain the peak threshold value according to the minimum first peak value among all the first peak values. Here, the peak threshold value can be, but is not limited to, the product result between the minimum first peak value among all the first peak values and 0.9. And it is not limited to this.
[0084] Next, after determining the peak threshold of the n-th frame heart rate detection signal, the control terminal may also divide and process the n-th frame heart rate detection signal according to a preset peak interval (which may be, but is not limited to, set to 0.2 seconds) to obtain a plurality of heart rate detection signal segments corresponding to the preset peak interval, and may determine at least one second peak value greater than the peak threshold value in each heart rate detection signal segment. It is understandable that when any peak value less than the peak threshold value is detected in each heart rate detection signal segment, it indicates that the peak value is an invalid peak value, and after each second peak value greater than the peak threshold value is detected, the peak threshold value may also be, but is not limited to, corrected according to the currently determined second peak value and the preset noise amplitude value to increase the adaptability and accuracy of the heart rate detection signal processing.
[0085] Then, after determining at least two second peaks of the heart rate detection signal of the nth frame, the control terminal can also calculate the heart rate data corresponding to the heart rate detection signal of the nth frame based on the mean result (ie, the first mean) corresponding to the peak intervals between all adjacent second peaks.
[0086] As another option of the embodiment of the present application, obtaining the heart rate data corresponding to the heart rate detection signal of the nth frame according to the first average value of all peak intervals includes:
[0087] Obtaining first heart rate data according to a first average value of all peak intervals, and determining a heartbeat interval of the n-th frame heart rate detection signal based on the first heart rate data;
[0088] When it is detected that the difference between any peak interval and the heartbeat interval is in a preset first difference interval, the latter second peak value of the two second peak values corresponding to the peak interval is removed;
[0089] The second heart rate data is obtained according to all the second peak values after the elimination process, and the second heart rate data is used as the heart rate data corresponding to the n-th frame heart rate detection signal.
[0090] In order to avoid the accuracy of the heart rate data being affected by the false detection of the peak value, when calculating the heart rate data corresponding to the n-th frame heart rate detection signal, the control terminal can first obtain the first heart rate data according to the average result of all peak intervals, and substitute the first heart rate data into the preset heartbeat interval expression to obtain the heartbeat interval of the n-th frame heart rate detection signal. Here, the preset heartbeat interval expression can be but is not limited to the following:
[0091]
[0092] In the above formula, It can correspond to the heartbeat interval of the nth frame heart rate detection signal. It may correspond to the first heart rate data of the n-th frame heart rate detection signal.
[0093] Next, after determining the heartbeat interval of the nth frame heart rate detection signal, the control terminal can perform a difference calculation between any peak interval and the heartbeat interval, and when any difference result is detected to be in the preset first difference interval, it indicates that the current peak interval has an abnormality caused by a misdetected peak, and then the latter of the two second peaks corresponding to the current peak interval can be eliminated. Here, the preset first difference interval can be, but is not limited to, [0.3*heartbeat interval, 0.7*heartbeat interval], and the heartbeat interval is the heartbeat interval of the nth frame heart rate detection signal.
[0094] Next, the peak interval between any two adjacent second peaks can be calculated based on all the second peaks after elimination, and the heart rate data of the nth frame heart rate detection signal can be calculated by referring to the above embodiment, which will not be described in detail here.
[0095] As another option of the embodiment of the present application, obtaining the second heart rate data according to all the second peak values after elimination processing includes:
[0096] When the difference between any peak interval and the heartbeat interval is detected in all the second peaks after the elimination process, and is within the preset second difference interval, the number of missed detections is calculated according to the peak interval and the heartbeat interval;
[0097] Screening out a portion of the heart rate detection signal between two second peaks corresponding to the peak interval in the nth frame heart rate detection signal, and determining at least one third peak corresponding to the number of missed detections in the portion of the heart rate detection signal;
[0098] All third peak values are updated to all second peak values after elimination, and second heart rate data are obtained according to all second peak values after update.
[0099] In order to avoid the accuracy of the heart rate data being affected by missed peaks, when calculating the heart rate data corresponding to the heart rate detection signal of the nth frame, the control terminal can also calculate the peak interval between any two adjacent second peaks among all the second peaks after elimination, and when the difference between any peak interval and the above-mentioned heartbeat interval is detected to be in the preset second difference interval, it indicates that the current peak interval has an abnormality caused by missed peaks, and then the current peak interval and heartbeat interval can be substituted into the preset number expression to calculate the number of missed detections. Here, the preset second difference interval can be set to be greater than 1.3*heartbeat interval, and the preset number expression can be, but is not limited to, as follows:
[0100]
[0101] In the above formula, n can correspond to the number of missed detections, and RRI can correspond to the current peak interval. It can correspond to the heartbeat interval of the n-th frame heart rate detection signal, and [] can correspond to a floor rounding function.
[0102] Then, after obtaining the number of missed detections, the control terminal can also filter out part of the heart rate detection signal between the two second peaks corresponding to the current peak interval in the heart rate detection signal of the nth frame, and can determine multiple peaks in the partial heart rate detection signal, so as to select all peaks consistent with the number of missed detections in the multiple peaks in order from large to small as the third peak.
[0103] Then, after determining the third peak, the control terminal can update the third peak in all the second peaks after the elimination process, and can calculate the peak interval between any two adjacent second peaks based on all the second peaks after the update process, and can refer to the above embodiment to calculate the heart rate data of the heart rate detection signal of the nth frame, which will not be elaborated here.
[0104] Step 106: extract at least two heart rate features from all heart rate detection signals and all heart rate data, and input all heart rate features into a preset random forest learning model to predict user emotions.
[0105] Specifically, after obtaining all the heart rate data, the control terminal can also extract at least two heart rate features from all the heart rate data and all the heart rate detection signals, so as to input all the heart rate features into the preset random forest learning model, and predict the user's current emotions with higher accuracy through the intelligent algorithm. Here, the preset random forest learning model can be trained by at least two emotion labels and at least two heart rate feature samples corresponding to each user emotion label, and the at least two emotion labels can be but are not limited to anxiety, tension, calmness and low vitality, and the at least two heart rate feature samples can be but are not limited to heart rate variability features, heart rate statistical features and heart rate frequency domain features, and the preset random forest learning model can use k-fold cross validation after training to evaluate performance indicators such as accuracy, recall rate or F1 score, but is not limited to this.
[0106] As another option of the embodiment of the present application, at least two heart rate features are extracted from all heart rate detection signals and all heart rate data, including:
[0107] Calculating a second mean of all peak intervals corresponding to all heart rate detection signals, and obtaining a heart rate variability feature according to the second mean;
[0108] Calculate the third mean, standard deviation, maximum value and minimum value corresponding to all heart rate data, and use the third mean, standard deviation, maximum value and minimum value as heart rate statistical features;
[0109] Fourier transform processing is performed on all heart rate detection signals to obtain heart rate frequency domain features, and heart rate variability features, heart rate statistical features and heart rate frequency domain features are used as at least two heart rate features.
[0110] Specifically, when at least two heart rate features are extracted, the control terminal may calculate the mean of all peak intervals corresponding to all heart rate detection signals to obtain a corresponding second mean, and substitute the second mean and all peak intervals into a preset standard deviation expression to calculate the standard deviation corresponding to the heart rate detection signal. Here, the preset standard deviation expression may be, but is not limited to, as follows:
[0111]
[0112] In the above formula, SDNN can correspond to the standard deviation corresponding to the heart rate detection signal, N can correspond to the number of all peak intervals, and RR i It can be corresponded to the i-th peak interval, It can correspond to the second mean.
[0113] In addition, the control terminal can also substitute all peak intervals into a preset square root expression to calculate the square root corresponding to the heart rate detection signal, and use the square root and the standard deviation mentioned above as the heart rate variability feature. Here, the preset square root expression can be but is not limited to the following:
[0114]
[0115] In the above formula, RMSSD can correspond to the square root corresponding to the heart rate detection signal, N can correspond to the number of all peak intervals, and RR i It can be corresponded to the i-th peak interval, RR i+1 It can correspond to the i+1th peak interval.
[0116] Then, the control terminal can also calculate the third mean (ie, the mean calculation result), standard deviation result, maximum value and minimum value according to all the heart rate data, and use the third mean, standard deviation result, maximum value and minimum value as the heart rate statistical features.
[0117] Next, the control terminal may also perform Fourier transform processing on all heart rate detection signals to obtain heart rate frequency domain features, and use the above-mentioned heart rate variability features, heart rate statistical features and the heart rate frequency domain features as at least two heart rate features.
[0118] Step 108: Query the playback scene corresponding to the user's emotion in the preset emotion-scene mapping list, and display the playback scene on the virtual reality device.
[0119] Specifically, after predicting the user's current emotion using the preset random forest learning model, the control terminal can, but is not limited to, query the playback scene corresponding to the user's current emotion in the preset emotion-scene mapping list, and can display the playback scene on the display interface of the virtual reality device, so as to achieve sleep assistance for the user in combination with the above-mentioned aromatherapy device. Here, the preset emotion-scene mapping list contains at least two manually calibrated defined emotions, and the playback scene set for each defined emotion, for example but not limited to, when the defined emotion is anxiety and tension, the corresponding playback scene can be a calm natural landscape, such as a calm forest or a calm lake; when the defined emotion is relatively calm, the corresponding playback scene can be a relaxing and pleasant scene, such as a beach, a park or a beautiful garden; when the defined emotion is low vitality, the corresponding playback scene can be a quiet, relaxing and sleep-inducing environment, such as the starry sky at night or a dim room.
[0120] As another option of the embodiment of the present application, after displaying the playback scene on the virtual reality device, the method further includes:
[0121] When the playback scene is the first scene, the preset scene sound effect is turned down, and the preset scene sound effect after the turning down is played;
[0122] When the playing scene is the second scene, the preset scene sound effect and white noise are superimposed, and the preset scene sound effect after the superimposition processing is played.
[0123] Specifically, in order to further improve the sleep-aiding effect, the control terminal may also, but is not limited to, when detecting that the playback scene is a first scene for representing a peaceful natural landscape, adjust down the preset scene sound effect to suit the overall presentation effect of the playback scene, and may synchronously play the preset scene sound effect after adjusting down when displaying the first scene. It is understandable that when detecting that the playback scene is a second scene for representing a quiet, relaxing, and sleep-inducing environment, the preset scene sound effect may be superimposed with white noise to suit the overall presentation effect of the playback scene, and may synchronously play the preset scene sound effect after superimposition when displaying the second scene. Here, the preset scene sound effect may be a synchronous scene sound effect corresponding to a scene representing a relaxing and pleasant scene, and is not limited thereto.
[0124] In addition, after the sleep-aiding function is completed, the virtual reality device in the embodiment of the present application can also collect feedback data through the user interface, such as but not limited to user ratings or other selection options, and use data analysis tools and techniques (such as Python's Pandas library) to analyze the collected data to adjust the playback scene selection and aromatherapy adjustment logic according to the analysis results, such as modifying the defined emotion type corresponding to the heart rate, or adjusting the mapping rules of the emotional state to the virtual reality environment, so as to achieve real-time optimization effects, thereby improving the user-friendliness and personalization level of the virtual reality device.
[0125] See also Figure 2 , Figure 2 A structural schematic diagram of an aromatherapy sleep-aiding control system based on a virtual reality device provided in an embodiment of the present application is shown.
[0126] The aromatherapy sleep aid control system based on virtual reality equipment can be applied to virtual reality equipment. An optical sensor is embedded inside the frame of the virtual reality equipment, and an aromatherapy device is set at the nose pad of the virtual reality equipment. Figure 2 As shown, the aromatherapy sleep-aiding control system based on virtual reality equipment may include at least a signal detection module 201, an aromatherapy control module 202, an emotion prediction module 203 and a scene display module 204, wherein:
[0127] The signal detection module 201 is used to obtain at least two frames of heart rate detection signals based on the optical sensor according to a preset sampling frequency after receiving a control instruction from the user;
[0128] Aromatherapy control module 202, used to process each frame of heart rate detection signal to obtain corresponding heart rate data, and determine an aromatherapy control signal according to all heart rate data and a preset heart rate threshold, so that the aromatherapy device performs output processing according to the aromatherapy control signal;
[0129] The emotion prediction module 203 is used to extract at least two heart rate features from all heart rate detection signals and all heart rate data, and input all heart rate features into a preset random forest learning model to predict user emotions; wherein the preset random forest learning model is trained by at least two emotion labels and at least two heart rate feature samples corresponding to each user emotion label;
[0130] The scene display module 204 is used to query the playback scene corresponding to the user's emotion in the preset emotion-scene mapping list and display the playback scene on the virtual reality device; wherein the preset emotion-scene mapping list includes at least two defined emotions and the playback scene corresponding to each defined emotion.
[0131] In some possible embodiments, processing each frame of the heart rate detection signal to obtain corresponding heart rate data includes:
[0132] Based on the heart rate data of the n-1th frame of the heart rate detection signal and a preset heart rate error, a minimum peak interval of the nth frame of the heart rate detection signal is obtained; wherein n is a positive integer greater than 1;
[0133] Determine at least two first peaks in the nth frame heart rate detection signal according to the minimum peak interval, and obtain a peak threshold according to the minimum first peak among all the first peaks;
[0134] Based on a preset peak interval and a peak threshold, at least two second peaks are determined in the nth frame of the heart rate detection signal; wherein each second peak is greater than the peak threshold;
[0135] The peak interval between any two adjacent second peak values is calculated, and the heart rate data corresponding to the n-th frame heart rate detection signal is obtained according to the first average value of all the peak intervals.
[0136] In some possible embodiments, obtaining the heart rate data corresponding to the n-th frame heart rate detection signal according to the first average value of all peak intervals includes:
[0137] Obtaining first heart rate data according to a first average value of all peak intervals, and determining a heartbeat interval of the n-th frame heart rate detection signal based on the first heart rate data;
[0138] When it is detected that the difference between any peak interval and the heartbeat interval is in a preset first difference interval, the latter second peak value of the two second peak values corresponding to the peak interval is removed;
[0139] The second heart rate data is obtained according to all the second peak values after the elimination process, and the second heart rate data is used as the heart rate data corresponding to the n-th frame heart rate detection signal.
[0140] In some possible embodiments, obtaining the second heart rate data according to all the second peak values after elimination includes:
[0141] When the difference between any peak interval and the heartbeat interval is detected in all the second peaks after the elimination process, and is within the preset second difference interval, the number of missed detections is calculated according to the peak interval and the heartbeat interval;
[0142] Screening out a portion of the heart rate detection signal between two second peaks corresponding to the peak interval in the nth frame heart rate detection signal, and determining at least one third peak corresponding to the number of missed detections in the portion of the heart rate detection signal;
[0143] All third peak values are updated to all second peak values after elimination, and second heart rate data are obtained according to all second peak values after update.
[0144] In some possible embodiments, determining the aromatherapy control signal according to all the heart rate data and a preset heart rate threshold includes:
[0145] Calculate the difference between each heart rate data and the preset heart rate threshold respectively, and obtain the difference control signal according to all the differences and the preset control parameters;
[0146] The difference control signal is converted and processed to obtain a servo control angle, and the servo control angle is used as an aromatherapy control signal; wherein the aromatherapy device includes an aromatherapy box and a servo arranged on a cover of the aromatherapy box, so that the opening and closing state of the cover of the aromatherapy box can be controlled by adjusting the control angle of the servo.
[0147] In some possible embodiments, at least two heart rate features are extracted from all heart rate detection signals and all heart rate data, including:
[0148] Calculating a second mean of all peak intervals corresponding to all heart rate detection signals, and obtaining a heart rate variability feature according to the second mean;
[0149] Calculate the third mean, standard deviation, maximum value and minimum value corresponding to all heart rate data, and use the third mean, standard deviation, maximum value and minimum value as heart rate statistical features;
[0150] Fourier transform processing is performed on all heart rate detection signals to obtain heart rate frequency domain features, and heart rate variability features, heart rate statistical features and heart rate frequency domain features are used as at least two heart rate features.
[0151] In some possible embodiments, after displaying the playback scene on the virtual reality device, the method further includes:
[0152] When the playback scene is the first scene, the preset scene sound effect is turned down, and the preset scene sound effect after the turning down is played;
[0153] When the playing scene is the second scene, the preset scene sound effect and the white noise are superimposed, and the preset scene sound effect after the superimposition processing is played.
[0154] Those skilled in the art can clearly understand that the technical solutions of the embodiments of the present application can be implemented with the help of software and / or hardware. The "unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array (Field-Programmable Gate Array, FPGA), an integrated circuit (Integrated Circuit, IC), etc.
[0155] See also Figure 3 , Figure 3 A structural schematic diagram of another aromatherapy sleep-aiding control system based on a virtual reality device provided in an embodiment of the present application is shown.
[0156] The aromatherapy sleep aid control system based on virtual reality equipment can be applied to virtual reality equipment. An optical sensor is embedded inside the frame of the virtual reality equipment, and an aromatherapy device is set at the nose pad of the virtual reality equipment. Figure 3 As shown, the aromatherapy sleep-aiding control system based on the virtual reality device may include at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .
[0157] The communication bus 302 may be used to realize the connection and communication among the above-mentioned components.
[0158] The user interface 303 may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.
[0159] The network interface 304 may include, but is not limited to, a Bluetooth module, an NFC module, a Wi-Fi module, etc.
[0160] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect various parts within the aromatherapy sleep-aiding control system 300 based on the virtual reality device, and executes various functions and processes data of the aromatherapy sleep-aiding control system 300 based on the virtual reality device by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of DSP, FPGA, and PLA. The processor 301 can integrate one or a combination of CPU, GPU, modem, etc. Among them, the CPU mainly processes the operating system, user interface, and application program; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 301, but may be implemented by a single chip.
[0161] The memory 305 may include a RAM or a ROM. Optionally, the memory 305 includes a non-transitory computer-readable medium. The memory 305 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may optionally be at least one storage device located away from the aforementioned processor 301. As Figure 3 As shown, the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an aromatherapy sleep aid control application based on a virtual reality device.
[0162] Specifically, the processor 301 may be used to call the aromatherapy sleep-aiding control application based on the virtual reality device stored in the memory 305, and specifically perform the following operations:
[0163] After receiving the user's control instruction, acquiring at least two frames of heart rate detection signals based on the optical sensor according to a preset sampling frequency;
[0164] Process each frame of the heart rate detection signal to obtain corresponding heart rate data, and determine an aromatherapy control signal based on all the heart rate data and a preset heart rate threshold, so that the aromatherapy device performs output processing according to the aromatherapy control signal;
[0165] Extracting at least two heart rate features from all heart rate detection signals and all heart rate data, and inputting all heart rate features into a preset random forest learning model to predict user emotions; wherein the preset random forest learning model is trained by at least two emotion labels and at least two heart rate feature samples corresponding to each user emotion label;
[0166] The playback scene corresponding to the user's emotion is queried in a preset emotion-scene mapping list, and the playback scene is displayed on a virtual reality device; wherein the preset emotion-scene mapping list includes at least two defined emotions and a playback scene corresponding to each defined emotion.
[0167] In some possible embodiments, processing each frame of the heart rate detection signal to obtain corresponding heart rate data includes:
[0168] Based on the heart rate data of the n-1th frame of the heart rate detection signal and a preset heart rate error, a minimum peak interval of the nth frame of the heart rate detection signal is obtained; wherein n is a positive integer greater than 1;
[0169] Determine at least two first peaks in the nth frame heart rate detection signal according to the minimum peak interval, and obtain a peak threshold according to the minimum first peak among all the first peaks;
[0170] Based on a preset peak interval and a peak threshold, at least two second peaks are determined in the nth frame of the heart rate detection signal; wherein each second peak is greater than the peak threshold;
[0171] The peak interval between any two adjacent second peak values is calculated, and the heart rate data corresponding to the n-th frame heart rate detection signal is obtained according to the first average value of all the peak intervals.
[0172] In some possible embodiments, obtaining the heart rate data corresponding to the n-th frame heart rate detection signal according to the first average value of all peak intervals includes:
[0173] Obtaining first heart rate data according to a first average value of all peak intervals, and determining a heartbeat interval of the n-th frame heart rate detection signal based on the first heart rate data;
[0174] When it is detected that the difference between any peak interval and the heartbeat interval is in a preset first difference interval, the latter second peak value of the two second peak values corresponding to the peak interval is removed;
[0175] The second heart rate data is obtained according to all the second peak values after the elimination process, and the second heart rate data is used as the heart rate data corresponding to the n-th frame heart rate detection signal.
[0176] In some possible embodiments, obtaining the second heart rate data according to all the second peak values after elimination includes:
[0177] When the difference between any peak interval and the heartbeat interval is detected in all the second peaks after the elimination process, and is within the preset second difference interval, the number of missed detections is calculated according to the peak interval and the heartbeat interval;
[0178] Screening out a portion of the heart rate detection signal between two second peaks corresponding to the peak interval in the nth frame heart rate detection signal, and determining at least one third peak corresponding to the number of missed detections in the portion of the heart rate detection signal;
[0179] All third peak values are updated to all second peak values after elimination, and second heart rate data are obtained according to all second peak values after update.
[0180] In some possible embodiments, determining the aromatherapy control signal according to all the heart rate data and a preset heart rate threshold includes:
[0181] Calculate the difference between each heart rate data and the preset heart rate threshold respectively, and obtain the difference control signal according to all the differences and the preset control parameters;
[0182] The difference control signal is converted and processed to obtain a servo control angle, and the servo control angle is used as an aromatherapy control signal; wherein the aromatherapy device includes an aromatherapy box and a servo arranged on a cover of the aromatherapy box, so that the opening and closing state of the cover of the aromatherapy box can be controlled by adjusting the control angle of the servo.
[0183] In some possible embodiments, at least two heart rate features are extracted from all heart rate detection signals and all heart rate data, including:
[0184] Calculating a second mean of all peak intervals corresponding to all heart rate detection signals, and obtaining a heart rate variability feature according to the second mean;
[0185] Calculate the third mean, standard deviation, maximum value and minimum value corresponding to all heart rate data, and use the third mean, standard deviation, maximum value and minimum value as heart rate statistical features;
[0186] Fourier transform processing is performed on all heart rate detection signals to obtain heart rate frequency domain features, and heart rate variability features, heart rate statistical features and heart rate frequency domain features are used as at least two heart rate features.
[0187] In some possible embodiments, after displaying the playback scene on the virtual reality device, the method further includes:
[0188] When the playback scene is the first scene, the preset scene sound effect is turned down, and the preset scene sound effect after the turning down is played;
[0189] When the playing scene is the second scene, the preset scene sound effect and the white noise are superimposed, and the preset scene sound effect after the superimposition processing is played.
[0190] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0191] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0192] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
Claims
1. An aromatherapy sleep-aiding control method based on virtual reality equipment, It is characterized in that The method is applied to a virtual reality device, wherein an optical sensor is embedded inside a frame of the virtual reality device, and an aromatherapy device is arranged at a nose pad of the virtual reality device, and the method comprises: After receiving the user's control instruction, acquiring at least two frames of heart rate detection signals based on the optical sensor according to a preset sampling frequency; Processing each frame of the heart rate detection signal to obtain corresponding heart rate data, and determining an aromatherapy control signal according to all the heart rate data and a preset heart rate threshold, so that the aromatherapy device performs output processing according to the aromatherapy control signal; Extracting at least two heart rate features from all the heart rate detection signals and all the heart rate data, and inputting all the heart rate features into a preset random forest learning model to predict the user's emotions; wherein the preset random forest learning model is trained by at least two emotion labels and at least two heart rate feature samples corresponding to each of the user's emotion labels; The playback scene corresponding to the user emotion is queried in a preset emotion-scene mapping list, and the playback scene is displayed on the virtual reality device; wherein the preset emotion-scene mapping list includes at least two defined emotions and a playback scene corresponding to each of the defined emotions.
2. The method according to claim 1, It is characterized in that The step of processing the heart rate detection signal of each frame to obtain corresponding heart rate data includes: Based on the heart rate data of the heart rate detection signal of the n-1th frame and a preset heart rate error, a minimum peak interval of the heart rate detection signal of the nth frame is obtained; wherein n is a positive integer greater than 1; Determine at least two first peaks in the heart rate detection signal of the nth frame according to the minimum peak interval, and obtain a peak threshold according to the minimum first peak among all the first peaks; Based on the preset peak interval and the peak threshold, at least two second peaks are determined in the heart rate detection signal of the nth frame; wherein each of the second peaks is greater than the peak threshold; The peak interval between any two adjacent second peak values is calculated, and the heart rate data corresponding to the heart rate detection signal of the nth frame is obtained according to the first average value of all the peak intervals.
3. The method according to claim 2, It is characterized in that The step of obtaining the heart rate data corresponding to the heart rate detection signal of the nth frame according to the first average value of all the peak intervals includes: Obtaining first heart rate data according to a first average value of all the peak intervals, and determining a heartbeat interval of the heart rate detection signal of the nth frame based on the first heart rate data; When it is detected that the difference between any one of the peak intervals and the heartbeat interval is in a preset first difference interval, the latter of the two second peaks corresponding to the peak interval is removed; The second heart rate data is obtained according to all the second peak values after elimination, and the second heart rate data is used as the heart rate data corresponding to the heart rate detection signal of the nth frame.
4. The method according to claim 3, It is characterized in that The step of obtaining the second heart rate data according to all the second peak values after elimination includes: When the difference between any one of the peak intervals and the heartbeat intervals is detected in all the second peaks after the elimination process and is within a preset second difference interval, the number of missed detections is calculated according to the peak interval and the heartbeat interval; Screening out a portion of the heart rate detection signal between two second peaks corresponding to the peak interval from the heart rate detection signal of the nth frame, and determining at least one third peak corresponding to the number of missed detections from the portion of the heart rate detection signal; All the third peak values are updated to all the second peak values after elimination, and the second heart rate data is obtained according to all the second peak values after update.
5. The method according to claim 1, It is characterized in that Determining the aromatherapy control signal according to all the heart rate data and a preset heart rate threshold includes: Calculating the difference between each of the heart rate data and a preset heart rate threshold value, and obtaining a difference control signal according to all the differences and a preset control parameter; The difference control signal is converted and processed to obtain a servo control angle, and the servo control angle is used as an aromatherapy control signal; wherein the aromatherapy device includes an aromatherapy box and a servo arranged on a cover of the aromatherapy box, so that the opening and closing state of the cover of the aromatherapy box can be controlled by adjusting the control angle of the servo.
6. The method according to claim 2, It is characterized in that The step of extracting at least two heart rate features from all the heart rate detection signals and all the heart rate data comprises: Calculating a second mean value of all the peak intervals corresponding to all the heart rate detection signals, and obtaining a heart rate variability feature according to the second mean value; Calculating a third mean, a standard deviation result, a maximum value, and a minimum value corresponding to all the heart rate data, and using the third mean, the standard deviation result, the maximum value, and the minimum value as heart rate statistical features; Fourier transform processing is performed on all the heart rate detection signals to obtain heart rate frequency domain features, and the heart rate variability features, the heart rate statistical features and the heart rate frequency domain features are used as at least two heart rate features.
7. The method according to claim 1, It is characterized in that After displaying the playback scene on the virtual reality device, the method further includes: When the playback scene is the first scene, the preset scene sound effect is turned down, and the preset scene sound effect after the turning down is played; When the playing scene is the second scene, the preset scene sound effect and white noise are superimposed, and the preset scene sound effect after the superimposition processing is played.
8. An aromatherapy sleep-aiding control system based on virtual reality equipment. It is characterized in that The system is applied to a virtual reality device, an optical sensor is embedded in the inner side of the frame of the virtual reality device, and an aromatherapy device is arranged at the nose pad of the virtual reality device. The system includes: A signal detection module, configured to obtain at least two frames of heart rate detection signals based on an optical sensor at a preset sampling frequency after receiving a control instruction from a user; An aromatherapy control module, used for processing each frame of the heart rate detection signal to obtain corresponding heart rate data, and determining an aromatherapy control signal according to all the heart rate data and a preset heart rate threshold, so that the aromatherapy device performs output processing according to the aromatherapy control signal; An emotion prediction module, used to extract at least two heart rate features from all the heart rate detection signals and all the heart rate data, and input all the heart rate features into a preset random forest learning model to predict the user's emotions; wherein the preset random forest learning model is trained by at least two emotion labels and at least two heart rate feature samples corresponding to each of the user's emotion labels; A scene display module is used to query the playback scene corresponding to the user emotion in a preset emotion-scene mapping list and display the playback scene on the virtual reality device; wherein the preset emotion-scene mapping list includes at least two defined emotions and the playback scene corresponding to each of the defined emotions.
9. An aromatherapy sleep-aiding control system based on virtual reality equipment. It is characterized in that including a processor and a memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the steps of the method according to any one of claims 1 to 7.
