Sleep data processing method and device
By performing attention transformation and dilated convolution processing at the sleep data segment level, the problem of high complexity in sleep data segment division in deep learning methods is solved, achieving efficient and accurate sleep data processing, which is suitable for consumer wearable devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG JIUZHI TECH CO LTD
- Filing Date
- 2025-12-08
- Publication Date
- 2026-04-21
Smart Images

Figure CN121901781A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of signal processing, specifically relating to a sleep data processing method and a sleep data processing device. Background Technology
[0002] Current research has shifted from traditional machine learning methods to deep learning methods to overcome the algorithmic bottlenecks in sleep monitoring, but this shift has primarily focused on academic research. In practical commercial applications, various limitations of deep learning methods, especially algorithmic complexity, lead to high complexity in dividing sleep data segments into corresponding sleep stages, thus reducing the efficiency of sleep data processing. Therefore, how to improve the efficiency of sleep data processing is a pressing issue that needs to be addressed.
[0003] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0004] The purpose of this application is to effectively improve the efficiency and accuracy of sleep data processing.
[0005] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0006] According to one aspect of the embodiments of this application, a sleep data processing method is provided, the method comprising: Acquire sleep data, which includes multiple sleep data segments, the duration of each sleep data segment being less than or equal to a first preset duration; Obtain the first feature representation of each sleep data segment; Attention transformation calculation is performed based on the first feature representation of each sleep data segment to obtain the second feature representation of each sleep data segment; The second feature representations of the multiple sleep data segments are subjected to dilated convolution to determine the sleep stage to which each sleep data segment belongs; Based on the sleep stages corresponding to the multiple sleep data segments, the sleep cycle corresponding to the sleep data is determined.
[0007] According to one aspect of the embodiments of this application, the step of performing attention transformation calculation based on the first feature representation of each sleep data segment to obtain a second feature representation of each sleep data segment includes: For each sleep data segment, obtain the valid information within the sleep data segment, as well as the dimension represented by the first feature; Based on the valid information within the sleep data segment, the first feature representation, and the dimension of the first feature representation, a first input feature sequence is obtained by combining them. An attention transformation calculation is performed on the first input feature sequence to obtain the second feature representation of the sleep data segment.
[0008] According to one aspect of the embodiments of this application, the step of performing attention transformation calculation on the first input feature sequence to obtain a second feature representation of the sleep data segment includes: The first input feature sequence is transformed by a linear transformation matrix to obtain the query vector, key vector, and value vector; Calculate the attention score based on the query vector and the key vector; The attention scores are normalized to obtain weight coefficients; The second feature representation of the sleep data segment is obtained based on the weighting coefficients and the value vector.
[0009] According to one aspect of the embodiments of this application, the step of performing dilated convolution on the second feature representations of the plurality of sleep data segments to determine the sleep stage to which each sleep data segment belongs includes: Based on the second feature representations of the multiple sleep data segments, a second input feature sequence is obtained by combining them. The second input feature sequence is sequentially dilated by multiple connected convolutional layers to obtain the third feature representations corresponding to the multiple sleep data segments respectively. The convolutional kernels of the multiple convolutional layers increase layer by layer. The third feature representation is a feature representation that integrates the second feature representation of each sleep data segment itself and the temporal dependency relationship of the second feature representations of related sleep data segments. Based on the third feature representation corresponding to each of the multiple sleep data segments, the probability distribution of each sleep stage corresponding to each sleep data segment is obtained, so as to determine the sleep stage to which each sleep data segment belongs.
[0010] According to one aspect of the embodiments of this application, the method further includes: The sleep data is bandpass filtered according to a set spectral range to obtain bandpass filtered sleep data. The set spectral range is determined based on the physiological rhythm frequency of at least one of heart rate and respiratory rate. The bandpass filtered sleep data is divided into multiple sleep data segments according to a second set duration, wherein the second set duration is less than or equal to the first set duration.
[0011] According to one aspect of the embodiments of this application, obtaining the first feature representation of each sleep data segment includes: Each sleep data segment is encoded to obtain a candidate feature representation corresponding to each sleep data segment; The candidate feature representation is compressed to obtain the first feature representation.
[0012] According to one aspect of the embodiments of this application, each sleep data segment includes a photoplethysmography (PPG) signal; the encoding process for each sleep data segment to obtain a candidate feature representation corresponding to each sleep data segment includes: The photoplethysmography signal is subjected to layer-by-layer convolution and downsampling to obtain a two-dimensional feature map, and the two-dimensional feature map is determined as the candidate feature representation. The compression process of the candidate feature representation to obtain the first feature representation includes: The two-dimensional feature map is transformed to obtain a one-dimensional feature vector; The one-dimensional feature vector is transformed to map it into a preset low-dimensional space to obtain an intermediate feature vector. The intermediate feature vector is nonlinearly activated to obtain the first feature representation.
[0013] According to one aspect of the embodiments of this application, sleep data is acquired through a sleep data processing model, which is trained in the following manner: Acquire sleep sample data, which includes multiple sleep data sample segments, the duration of which is less than or equal to a first set duration; The sleep sample data is input into the model to be trained, and the following steps are performed through the model to be trained: Obtain the first sample feature representation for each sleep data sample segment; Based on each sleep data sample segment, an attention transformation calculation is performed on the first sample feature representation to obtain the second sample feature representation of each sleep data sample segment; The second sample feature representations of the multiple sleep data sample segments are subjected to dilated convolution to determine the predicted sleep stage to which each sleep data sample segment belongs; Based on the predicted sleep stages corresponding to the multiple sleep data sample segments, the predicted sleep cycle corresponding to the sleep sample data is determined. Based on the loss between the predicted sleep cycle and the expected sleep cycle corresponding to the sleep sample data, the model parameters of the model to be trained are adjusted to obtain the sleep data processing model.
[0014] According to one aspect of an embodiment of this application, obtaining sleep sample data includes: Receives compressed sleep data sent by the smart ring, wherein the compressed sleep data is obtained by the smart ring compressing the original sleep data; The compressed sleep data is decompressed to obtain reconstructed sleep data; The original sleep data and the reconstructed sleep data are fused to obtain the sleep sample data.
[0015] According to one aspect of the embodiments of this application, a sleep data processing apparatus is provided, the apparatus comprising: The sleep data acquisition module is configured to acquire sleep data, which includes multiple sleep data segments, the duration of each sleep data segment being less than or equal to a first preset duration. The first feature representation acquisition module is configured to acquire the first feature representation of each sleep data segment; The attention transformation calculation module is configured to perform attention transformation calculation based on the first feature representation of each sleep data segment to obtain the second feature representation of each sleep data segment; The dilated convolution module is configured to perform dilated convolution on the second feature representations of the multiple sleep data segments to determine the sleep stage to which each sleep data segment belongs; The sleep cycle determination module is configured to determine the sleep cycle corresponding to the sleep data based on the sleep stages corresponding to the multiple sleep data segments.
[0016] This application provides a sleep data processing method. The method acquires sleep data, which includes multiple sleep data segments. It obtains a first feature representation for each sleep data segment and performs attention transformation calculation based on the first feature representation of each sleep data segment. This method not only strictly limits the scope of the attention transformation calculation to a single sleep data segment but also restricts the duration of each sleep data segment to a range less than or equal to a first set duration. This significantly reduces the complexity of the attention transformation calculation, thereby improving the efficiency of sleep data processing and reducing the computing power and memory requirements of the terminal device, enabling low-latency, low-power edge deployment. By performing attention transformation calculations, the system can automatically focus on the high-quality portions of sleep data segments while ignoring local noise, thus effectively resolving sleep stage misjudgments caused by low-motion and micro-movement (nighttime tics) scenarios. Furthermore, by performing dilated convolutions on the second feature representations of multiple sleep data segments, and by using dilated convolutions to jump and view contextual information, the system reduces computational load while improving the accuracy of identifying the sleep stage for each sleep data segment, avoiding unreasonable jumps in sleep stages. Based on the sleep stages corresponding to multiple sleep data segments, the system determines the corresponding sleep cycle, further ensuring the temporal stability and physiological rationality of the sleep cycle.
[0017] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0020] Figure 1 A flowchart of a sleep data processing method according to an embodiment of this application is shown.
[0021] Figure 2 A flowchart of a sleep data processing method according to another embodiment of this application is shown.
[0022] Figure 3 A flowchart of a sleep data processing method according to another embodiment of this application is shown.
[0023] Figure 4 A flowchart of a sleep data processing method according to another embodiment of this application is shown.
[0024] Figure 5 A flowchart of a sleep data processing method according to another embodiment of this application is shown.
[0025] Figure 6 A flowchart of a sleep data processing method according to another embodiment of this application is shown.
[0026] Figure 7 A flowchart of a sleep data processing method according to another embodiment of this application is shown.
[0027] Figure 8 A flowchart of a sleep data processing method according to another embodiment of this application is shown.
[0028] Figure 9 A schematic diagram of a sleep data processing apparatus according to an embodiment of this application is shown.
[0029] Figure 10 A schematic diagram of a sleep data processing system according to an embodiment of this application is shown.
[0030] Figure 11 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation
[0031] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0032] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0033] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0034] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily need to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0035] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0036] Current research has shifted from traditional machine learning methods to deep learning methods to overcome the algorithmic bottlenecks in sleep monitoring, but this shift has primarily focused on academic research. In practical commercial applications, various limitations of deep learning methods, especially algorithmic complexity, lead to high complexity in dividing sleep data segments into corresponding sleep stages, thus reducing the efficiency of sleep data processing. Therefore, how to improve the efficiency of sleep data processing is a pressing issue that needs to be addressed.
[0037] Before introducing the technical solutions of the embodiments of this application, the sleep data processing technology used in the embodiments of this application will be introduced first.
[0038] Deep learning specifically refers to machine learning based on deep neural network models and methods. It has evolved from statistical machine learning, artificial neural networks, and other algorithmic models, combined with the development of modern big data and high-performance computing. The most important technical characteristic of deep learning is its ability to automatically extract features; these extracted features are also called deep features or deep feature representations. Compared to manually designed features, deep features offer stronger and more robust representational capabilities.
[0039] The attention mechanism originates from research on human vision. In cognitive science, due to the bottleneck of information processing, humans selectively focus on a portion of all information while ignoring other visible information. This mechanism is commonly referred to as the attention mechanism.
[0040] Convolutional Neural Networks (CNNs) are a type of feedforward neural network widely used in image recognition and vision tasks, and are one of the core models in deep learning. Through a hierarchical structure of convolutional layers, pooling layers, and fully connected layers, they automatically extract local features from input data, progressively compress information, reduce redundancy, and improve generalization ability.
[0041] Sleep stages are physiological stages divided based on changes in electroencephalogram (EEG), eye movements, and muscle tone during sleep. They are divided into non-rapid eye movement sleep (NREM, also known as orthostatic sleep, slow-wave sleep, synchronous sleep, or quiet sleep) and rapid eye movement sleep (REM, also known as paradoxical sleep, rapid eye movement sleep, desynchronized sleep, active sleep, or Rem stage).
[0042] Photoplethysmography (PPG) is a non-invasive detection technology based on the photoelectric effect, primarily used to measure changes in blood volume within the microvascular bed. Its working principle involves illuminating the skin with an infrared light source; the reflected light is received by a photoelectric sensor and converted into an electrical signal. When the heart beats, blood flow causes changes in the volume of blood vessels in the skin, resulting in changes in the intensity of the reflected light. PPG technology is widely used for monitoring physiological parameters such as heart rate and blood oxygen saturation, and is gradually evolving from consumer-grade health devices to medical-grade diagnostic equipment. The advantages of this technology lie in its simplicity, non-invasiveness, ease of implementation, and applicability to various wearable devices.
[0043] Bandpass filtering is an electronic filtering method that allows signals within a specific frequency range to pass through while suppressing other frequencies. It consists of a cascaded low-pass filter and a high-pass filter. Its working principle is that the high-pass filter removes low-frequency signals, the low-pass filter removes high-frequency signals, and the intermediate-frequency signal is retained.
[0044] Based on the aforementioned sleep data processing technology and the problem of excessive algorithm complexity in related technologies, embodiments of this application provide a new sleep data processing method. Figure 1 A flowchart of a sleep data processing method according to an embodiment of this application is shown. Specifically, as follows: Figure 1 As shown, the sleep data processing method includes the following steps S110-S150: S110, acquire sleep data, which includes multiple sleep data segments, the duration of each sleep data segment being less than or equal to a first set duration.
[0045] S120, obtain the first feature representation of each sleep data segment.
[0046] S130, attention transformation calculation is performed based on the first feature representation of each sleep data segment to obtain the second feature representation of each sleep data segment.
[0047] S140, dilated convolution is performed on the second feature representations of multiple sleep data segments to determine the sleep stage to which each sleep data segment belongs.
[0048] S150 determines the sleep cycle corresponding to the sleep data based on the sleep stages corresponding to multiple sleep data segments.
[0049] The following sections will elaborate on S110-S150 respectively.
[0050] In S110, in some embodiments of this application, in the field of consumer wearable devices, sleep data is acquired by collecting light sensors in wearable devices (such as smart rings and watches). Sleep data can be obtained through photoplethysmography (PPG), which reflects fluctuations in the volume of blood vessels under the skin of the hand as a function of heart rate and respiration. Sleep data may include key physiological indicators such as heart rate (and heart rate variability) and respiratory rhythm. Heart rate variability reflects autonomic nervous activity, and respiratory rhythm helps determine sleep stability.
[0051] In some embodiments of this application, the sleep data includes multiple sleep data segments, each of which is a set of raw sampled data of a predetermined length. There is no data overlap between the sleep data segments.
[0052] In some embodiments of this application, sleep data can be acquired by a separate data acquisition link. This data acquisition link may include three core components: a light source (such as an LED, light-emitting diode), a photosensor (such as a PD), and a signal transmission circuit. Its function is to collect and output a complete stream of sleep data from a specific part of the human body (such as the fingertip).
[0053] In some embodiments of this application, the sampling rate of sleep data is 25 Hz, that is, 25 data points are collected per second. If the length is set to 250 sampling points, the time length is "250 points ÷ 25 points / second = 10 seconds". Therefore, the time length corresponding to 250 sampling points is 10 seconds, that is, each sleep data segment corresponds to 10 seconds of continuous sleep data.
[0054] In some embodiments of this application, in order to further improve the processing efficiency for a single sleep data segment, the duration of each sleep data segment is less than or equal to a first preset duration. The first preset duration can be 30 seconds or 1 minute.
[0055] It should be noted that the sampling rate, set length, and first set duration of the sleep signal can also be other values, and this embodiment does not limit their specific values.
[0056] In some embodiments of this application, the wearable device is a smart ring, and the sleep data can be compressed sleep data transmitted from the smart ring.
[0057] In S120, feature representation is an important concept in machine learning and data mining, referring to how raw data is transformed into a feature form suitable for model processing. It is closely related to feature extraction, which focuses on extracting useful information from raw data, while feature representation focuses on how to effectively encode this information so that the algorithm can understand it and make accurate judgments and predictions.
[0058] In some embodiments of this application, each sleep data segment is input into an encoder to obtain a first feature representation of each sleep data segment, wherein the first feature representation may be a feature vector.
[0059] In some embodiments of this application, the encoder parameters are configured as follows: Conv-BN-GELU×4, i.e., convolution-batch normalization-activation function, repeated four times; channels [32, 64, 128, 128], stride [2, 2, 2, 1], containing residuals, Dropout 0.1.
[0060] In some embodiments of this application, the encoder can be a convolutional residual encoder. A convolutional residual encoder may include multiple one-dimensional convolutional layers, each used to extract different physiological features during sleep. For example, layers 1-2 primarily learn heart rate waveform details, as different sleep stages exhibit different heart rate variability (HRV) differences, particularly sensitive to increased HRV during REM sleep; layers 3-4 primarily capture respiratory rhythms, with a clear and regular respiratory rhythm during deep sleep; layers 5-8 primarily extract autonomic nervous activity information to reflect the switching of the autonomic nervous system across different sleep stages. By downsampling through layer-by-layer convolution, each layer captures features at different time scales while significantly reducing the data throughput of the terminal device; for example, 10 hours of sleep data is reduced from 1,228,800 sampling points to 4,800 sampling points.
[0061] In some embodiments of this application, residual connections can be performed under multi-layer convolution to connect the information channels of shallow and deep layers. The output of each layer is added to the input of that layer (out = out + x). This ensures that the original local features are not lost as the network deepens, while incorporating long-range contextual information to prevent the deep network degradation common in deep networks and ensure that the heartbeat details of shallow layers are not lost in deep layers.
[0062] Therefore, unlike traditional methods that require extracting HRV features or respiratory rhythm as input, this approach, which allows the model to automatically learn the optimal feature representation, exhibits better robustness. Considering that everyone's sleep characteristics differ, a uniform feature extraction method struggles to capture individual differences. Unlike the commonly used approach of writing algorithms to extract heart rate features and then inputting them into the model, this automatic feature extraction method is more beneficial in reducing individual variability.
[0063] In S130, attention transformation calculation is performed based on the first feature representation of each sleep data segment. By strictly limiting the scope of attention calculation to a single sleep data segment, rather than performing attention transformation calculation on all sleep data segments at the same time, the complexity of attention transformation calculation can be significantly reduced, thereby improving the efficiency of sleep data processing and reducing the computing power and memory requirements of terminal devices, so as to achieve low latency and low power consumption edge deployment.
[0064] By performing attention transformation calculations based on the first feature representation of each sleep data segment, it is possible to automatically focus on the high-quality parts of the sleep data segment and ignore the local noise parts, thereby effectively solving the misjudgment of sleep stages caused by low-motion and limb micro-movement (nighttime tics) scenarios.
[0065] In some embodiments of this application, the second feature representation may be key feature information.
[0066] In S140, the second feature representations of multiple sleep data segments are subjected to dilated convolution. By jumping to view context information through dilated convolution, the second feature representation of each sleep data segment incorporates the sleep structure information of the hours before and after it. This reduces the amount of computation and improves the accuracy of the sleep stage to which each sleep data segment belongs, avoiding unreasonable jumps in the sleep stage to which the sleep data segment belongs (for example, if the current sleep data segment is preceded and followed by deep sleep, the probability of the current sleep data segment being judged as awake will be suppressed).
[0067] In some embodiments of this application, the sleep stages may include light sleep, deep sleep, REM sleep, and wakefulness. In S150, based on the sleep stage sequence of all sleep data segments, the complete cycle of the sleep cycle corresponding to the sleep data is identified, and key indicators such as the duration of each sleep cycle and the proportion of each stage are quantified, thereby providing a core basis for sleep quality assessment.
[0068] In some embodiments of this application, the sleep stages of each sleep data segment are arranged in chronological order to form a complete sleep stage time sequence. Based on this complete sleep stage time sequence, cycle segmentation is performed to divide the sleep data into corresponding sleep cycles. For example, if the period from 2:25 to 4:30 is considered light sleep, then 2:25 to 4:30 constitutes one sleep cycle, and this sleep cycle is a light sleep cycle.
[0069] Therefore, based on the sleep stages corresponding to multiple sleep data segments, the sleep cycle corresponding to the sleep data is determined, further ensuring the temporal stability and physiological rationality of the sleep cycle corresponding to the sleep data.
[0070] Figure 2 A flowchart of a sleep data processing method according to another embodiment of this application is shown. Figure 2 As shown, in some embodiments of this application, attention transformation calculation is performed based on the first feature representation of each sleep data segment to obtain the second feature representation of each sleep data segment, including the following steps S210-S230: S210: For each sleep data segment, obtain the effective information within the sleep data segment, as well as the dimension of the first feature representation.
[0071] S220, based on the effective information within the sleep data segment, the first feature representation, and the dimension of the first feature representation, a first input feature sequence is obtained by combining them.
[0072] S230, perform attention transformation calculation on the first input feature sequence to obtain the second feature representation of the sleep data segment.
[0073] The following sections will elaborate on S210-S230 respectively.
[0074] In S210, valid information within the sleep data segment is obtained through the classification token; the dimension of the first feature representation is determined based on the first feature representation of the sleep data segment. If the first feature representation has 128 dimensions, then the dimension of the first feature representation is 128.
[0075] In some embodiments, a register token stores metadata carriers for classification aids of a single sleep data segment. The metadata may include signal quality and confidence level. The register token acts as a lightweight prior memory, enhancing robustness to weak artifacts. The number of register tokens R∈[0,2].
[0076] In S220, in some embodiments of this application, the first input feature sequence is represented by the following formula: Zt=[CLS, R1…RR, yt] Where Zt represents the first input feature sequence; R1…RR represents the first feature representation; and yt represents the dimension of the first feature representation.
[0077] By combining the first input feature sequence, "effective information, first feature representation, and original dimension information" are treated as a unified input, so that the attention mechanism does not need to process multiple types of scattered information separately, thereby simplifying the calculation process and reducing the computational power consumption on the edge.
[0078] In S230, within the limited scope of a single sleep data segment, the weights of each element in the first input feature sequence are dynamically adjusted through attention transformation calculation to highlight effective physiological features, suppress low-quality signal interference, and generate a more discriminative second feature representation.
[0079] In commonly used algorithms, poor signal quality is often misinterpreted as motion or other interference, leading to incorrect classification of segments with poor signal quality as waking states. Automatically reducing attention weights can mitigate misjudgments caused by transient interference. This is particularly suitable for intermittent signal quality issues caused by unstable ring wearing (in fact, many users experience signal quality degradation due to ring loosening or shifting at night). Existing methods mostly discard low-quality segments (loss of information) or accept all segments (introducing noise). The attention mechanism employed in this scheme achieves soft quality weighting while limiting attention to a single sleep data segment, achieving a complexity of only O(4^2), effectively avoiding the O(1200^2) complexity explosion of full-sequence attention.
[0080] In some embodiments of this application, the parameters of the attention mechanism are configured as follows: number of layers 1–2; head=4; hidden dimension=128; registered token R=1.
[0081] Figure 3 A flowchart of a sleep data processing method according to another embodiment of this application is shown. Figure 3 As shown, in some embodiments of this application, attention transformation calculation is performed on the first input feature sequence to obtain the second feature representation of the sleep data segment, including the following S310-S340: S310, the first input feature sequence is transformed by a linear transformation matrix to obtain the query vector, key vector and value vector.
[0082] S320: Calculate the attention score based on the query vector and key vector.
[0083] S330, normalize the attention score to obtain the weight coefficient.
[0084] S340, based on the weighting coefficients and value vectors, obtains the second feature representation of the sleep data segment.
[0085] The following sections will elaborate on S310-S340 respectively.
[0086] In S310, in some embodiments of this application, the first input feature sequence is transformed by three linear transformation matrices to obtain the query vector Query (Q), the key vector Key (K), and the value vector Value (V).
[0087] In S320, in some embodiments of this application, the dot product of the query vector and the key vector is calculated ( The attention score is obtained by analyzing the sleep data signal. If a segment of sleep data is an artifact (such as noise caused by finger movement), its correlation with classification is low; if a segment of sleep data is a clear pulse wave, its correlation with classification is high.
[0088] In S330, in some embodiments of this application, the attention score is normalized to obtain normalized weight coefficients (probability distribution). The weight coefficients determine the degree of attention the sleep data processing model pays to different parts of the sleep data signal when aggregating information.
[0089] In S340, in some embodiments of this application, a weighted summation is performed using weight coefficients and value vectors to obtain a second feature representation of the sleep data segment. Thus, the entire process achieves recalibration, i.e., automatically suppressing noise interference and extracting pure physiological features.
[0090] Figure 4 A flowchart of a sleep data processing method according to another embodiment of this application is shown. Figure 4 As shown, in some embodiments of this application, the second feature representations of multiple sleep data segments are subjected to dilated convolution to determine the sleep stage to which each sleep data segment belongs, including the following steps S410-S430: S410, based on the second feature representation of multiple sleep data segments, the second input feature sequence is obtained by combining them.
[0091] S420, through multiple convolutional layers connected in sequence, dilated convolution is performed on the second input feature sequence to obtain the third feature representation corresponding to each of the multiple sleep data segments. The convolutional kernels of the multiple convolutional layers increase layer by layer. The third feature representation is a feature representation that integrates the second feature representation of each sleep data segment itself and the temporal dependency relationship of the second feature representation of the related sleep data segments.
[0092] S430, based on the third feature representation corresponding to each of the multiple sleep data segments, obtains the probability distribution of each sleep stage corresponding to each sleep data segment, so as to determine the sleep stage to which each sleep data segment belongs.
[0093] The following sections will elaborate on S410-S430 respectively.
[0094] In S410, in some embodiments of this application, the second feature representations of multiple sleep data segments are spliced together in chronological order on the time axis to obtain a second input feature sequence.
[0095] In S420, the second input feature sequence is sequentially dilated through multiple connected convolutional layers to automatically learn and capture the contextual dependencies inherent in the second input feature sequence. These multiple convolutional layers can be up to six one-dimensional convolutional layers. The convolutional kernels of these layers increase in size layer by layer; for example, the kernels of the first to sixth convolutional layers can be 1, 2, 4, 8, 16, and 32, respectively.
[0096] In some embodiments of this application, the dilation rate sequence d = {1, 2, 4, 8, 16, 32, ...} means that the convolutional kernel samples every d-1 sleep data segments as it slides. For example, if the dilation rate d = 1, the receptive field is 3, i.e., the current sleep data segment and one sleep data segment to its left and right. If the dilation rate d = 2, there are gaps in the middle of the convolutional kernel; adjacent sleep data segments are skipped, and the focus is on the current sleep data segment and the sleep data segments with a distance of 2 to its left and right. If the dilation rate is 32, the convolutional kernel has a very large span, and the focus is on the current sleep data segment and the sleep data segments with a distance of 32 to its left and right.
[0097] In some embodiments of this application, dilated convolution is used instead of ordinary convolution. Dilated convolution, by introducing "holes" (or "dilation rates") into the convolution kernel, can exponentially expand the receptive field of the convolution without increasing the amount of computation and parameters, enabling the receptive field of the convolution to reach hundreds of sleep data segments (>3 hours) and capture the entire sleep cycle.
[0098] Meanwhile, the contextual relationships summarized by dilated convolution can avoid unreasonable jumps. If the current sleep data segment is preceded and followed by deep sleep, the probability of jumping to wakefulness in the middle segment will be weighted lower. Dilated convolution is also beneficial for capturing sleep inertia. For example, if the preceding duration of the same sleep cycle is relatively long, the probability of the current sleep data segment being in the same cycle will be dynamically reduced.
[0099] Furthermore, the method of summarizing contextual relationships through dilated convolution has linear complexity, with a computational cost of O(S·k) far less than O(S^2), making it suitable for mobile deployment and achieving an overnight inference latency of less than 5 seconds. In contrast, current algorithms typically use Long Short-Term Memory (LSTM) networks or gated recurrent units (GRUs) for LSM when contextual relationships are needed. However, sleep tasks inherently have long time sequences, making it difficult for LSM networks and similar methods to capture extremely long-term dependencies (gradient vanishing). Attention mechanisms, as the optimal method for contextual relationships, have excessively high computational complexity. Dilated convolution balances long-range modeling capability with computational efficiency. After stacking 6 layers, the receptive field reaches over 3 hours, covering 2-3 complete sleep cycles.
[0100] In some embodiments of this application, the parameters of the dilated convolution are configured as follows: kernel_size=7, d={1,2,4,8,16,32}, number of layers 6, residual + layer normalization.
[0101] In S430, based on the third feature representation corresponding to multiple sleep data segments, the probability distribution of each sleep stage is output through the linear classification head, thereby determining the sleep stage (such as wakefulness, light sleep, deep sleep, REM) to which each sleep data segment belongs based on the probability distribution.
[0102] For example, if the probability distribution output by the linear classification head is [0.05, 0.85, 0.08, 0.02], corresponding to wakefulness, light sleep, deep sleep, and REM sleep respectively, then the sleep data segment will ultimately be determined to be in the "light sleep" stage. The sleep stage in which the sleep data segment is located can be the sleep stage corresponding to the highest probability.
[0103] Figure 5 A flowchart of a sleep data processing method according to another embodiment of this application is shown. Figure 5 As shown, in some embodiments of this application, the method further includes the following steps S510-S520: S510 performs bandpass filtering on sleep data according to a set spectrum range to obtain bandpass filtered sleep data. The set spectrum range is obtained based on the physiological rhythm frequency of at least one of heart rate and respiratory rate.
[0104] S520: Divide the bandpass filtered sleep data into multiple sleep data segments according to the second set duration, wherein the second set duration is less than or equal to the first set duration.
[0105] The following sections will elaborate on S510-S520 respectively.
[0106] In S510, the set spectrum range can be obtained based on the heart rate setting. The set spectrum range based on the heart rate setting is 0.5 Hz to 5 Hz. The set spectrum range based on the heart rate setting can be other values, and this implementation does not limit this.
[0107] In some other embodiments of this application, the set spectrum range can be obtained based on the respiratory rate. The set spectrum range based on the respiratory rate is 0.25 Hz to 0.5 Hz. The set spectrum range based on the respiratory rate can be other values, and this embodiment does not limit this.
[0108] In some other embodiments of this application, the set spectrum range can be obtained based on both heart rate and respiratory rate. The set spectrum range based on both heart rate and respiratory rate is 0.25 Hz to 5 Hz. The set spectrum range based on heart rate and respiratory rate can also be other values, and this embodiment does not limit this.
[0109] In the S520, continuous bandpass filtered sleep data is divided into multiple independent sleep data segments according to a set duration, forming a standardized processing unit.
[0110] In some embodiments of this application, the second set duration is less than or equal to the first set duration. If the second set duration is 30 seconds, and the original data sampling rate is 25Hz, then each sleep data segment contains 25Hz × 30 seconds = 750 sampling points, ensuring a uniform length for each sleep data segment. The second set duration can also be other values; this embodiment does not limit its specific value.
[0111] Figure 6 A flowchart of a sleep data processing method according to another embodiment of this application is shown. Figure 6 As shown, in some embodiments of this application, obtaining the first feature representation of each sleep data segment includes S610-S620: S610, each sleep data segment is encoded to obtain the candidate feature representation corresponding to each sleep data segment.
[0112] S620, the candidate feature representation is compressed to obtain the first feature representation.
[0113] The following sections will elaborate on S610-S620 respectively.
[0114] In S610, discriminative, multi-scale physiological features are extracted from the original, high-dimensional sleep data segments (such as PPG signals), namely, candidate feature representations corresponding to the sleep data segments.
[0115] In some embodiments of this application, a convolutional residual encoder is used. After processing by the encoder, the original signal is converted into a two-dimensional feature map, i.e., a candidate feature representation.
[0116] In S620, while preserving key physiological information, the candidate feature representations are further compressed in dimension and refined in information, ultimately obtaining a first feature representation with fixed dimensions and high computational efficiency.
[0117] In some embodiments of this application, sleep data is obtained through a sleep data processing model, which is trained in the following manner: Acquire sleep sample data, which includes multiple sleep data sample segments, each with a duration less than or equal to a first predetermined duration. Input the sleep sample data into the model to be trained, and perform the following steps through the model: obtain the first sample feature representation of each sleep data sample segment; perform attention transformation calculation on the first sample feature representation based on each sleep data sample segment to obtain the second sample feature representation of each sleep data sample segment; perform dilated convolution on the second sample feature representations of multiple sleep data sample segments to determine the predicted sleep stage to which each sleep data sample segment belongs; determine the predicted sleep cycle corresponding to the sleep sample data based on the predicted sleep stages corresponding to the multiple sleep data sample segments; adjust the model parameters of the model to be trained based on the loss between the predicted sleep cycle and the expected sleep cycle corresponding to the sleep sample data to obtain the sleep data processing model.
[0118] Figure 7 A flowchart of a sleep data processing method according to another embodiment of this application is shown. Figure 7 As shown, specifically, in some embodiments of this application, each sleep data segment includes a photoplethysmography (PPG) signal; each sleep data segment is encoded to obtain a candidate feature representation corresponding to each sleep data segment, including the following S710: S710 performs layer-by-layer convolution and downsampling on the photoplethysmography signal to obtain a two-dimensional feature map, and determines the two-dimensional feature map as a candidate feature representation.
[0119] The candidate feature representations are compressed to obtain the first feature representation, which includes the following S720-S740: S720 performs data transformation on the two-dimensional feature map to obtain a one-dimensional feature vector.
[0120] S730 performs data transformation on a one-dimensional feature vector to map the one-dimensional feature vector to a preset low-dimensional space to obtain an intermediate feature vector.
[0121] S740 performs nonlinear activation on the intermediate feature vector to obtain the first feature representation.
[0122] The following sections will elaborate on S710-S740 respectively.
[0123] In the S710, multi-scale, structured physiological features are extracted from the original photoplethysmography (PPG) signal through a combination of "layer-by-layer convolution + downsampling". The original signal is converted into a two-dimensional feature map, which not only preserves key information related to sleep stages (such as heart rate fluctuations, respiratory modulation, and pulse morphology) but also achieves preliminary data compression, laying the foundation for subsequent precise compression.
[0124] In S720, the candidate feature representation of the "time × channel" two-dimensional structure is converted into a one-dimensional vector form, eliminating the difference in dimensional structure, adapting to the input requirements of subsequent linear transformation, while not changing the core information of the features, only adjusting the data arrangement, and significantly compressing the backend computation and memory usage.
[0125] In S730, while preserving key physiological information of sleep stages, a linear transformation is used to accurately compress the high-dimensional one-dimensional feature vector, reducing the data dimensionality and computational complexity. At the same time, the features are mapped to a unified low-dimensional space, providing efficient input for subsequent nonlinear activation and attention calculations.
[0126] In S740, the nonlinear interaction capability of features is introduced through a nonlinear activation function to enhance the discriminative power of intermediate feature vectors—highlighting effective physiological features (such as the smooth heart rate variability during deep sleep and the high fluctuation HRV during REM sleep), suppressing weak noise, and finally outputting the first feature representation adapted to attention calculation.
[0127] Figure 8 A flowchart of a sleep data processing method according to another embodiment of this application is shown. Figure 8 As shown, in some embodiments of this application, obtaining sleep sample data includes the following steps S810-S830: S810 receives compressed sleep data sent by the smart ring. The compressed sleep data is obtained by compressing the original sleep data by the smart ring. The S820 decompresses the compressed sleep data to obtain reconstructed sleep data.
[0128] S830 fuses raw sleep data and reconstructed sleep data to obtain sleep sample data.
[0129] The following sections will elaborate on S810-S830 respectively.
[0130] In the S810, sleep data collected and compressed by the smart ring in actual use scenarios is acquired. This ensures that the sample data used for training is consistent with the input data format during edge deployment, avoiding domain differences between the raw training data and the compressed data used for deployment. This lays the data foundation for subsequent model adaptation to edge-side compressed signals. The raw sleep data, high-quality PPG signals without compression, contains complete high- and low-frequency physiological features, providing the model with accurate sleep stage feature benchmarks.
[0131] The smart ring serves as the primary data acquisition device, equipped with a light sensor to collect PPG signals (raw sleep data) from the user's fingertip. These signals include sleep-related physiological information such as heart rate, respiratory modulation, and autonomic nervous activity. The PPG signal contains multi-scale physiological information—high-frequency pulse waveforms, mid-frequency respiratory modulation, and low-frequency autonomic nervous activity. To accommodate low-power and low-storage hardware constraints, the smart ring performs real-time compression processing on the raw sleep data, preferably using a Discrete Cosine Transform (DCT) compression algorithm with a compression ratio of 10:1. Only the key low-frequency components of the PPG signal (corresponding to the 0.25-5Hz sleep-related frequency band) are retained, while redundant high-frequency components are discarded. The smart ring can transmit the compressed sleep data to terminal devices (such as mobile phones or servers) via Bluetooth Low Energy (BLE) or Wi-Fi. The terminal devices receive the compressed sleep data through their corresponding communication modules, ensuring no data loss or distortion during transmission.
[0132] In some embodiments of this application, a segment-level one-dimensional DCT-II (Discrete Cosine Transform-II) transformation is performed on each sleep signal data segment to compress it into a DCT data segment. Segment-level means performing the DCT transformation separately on each independent sleep signal data segment, rather than transforming the entire continuous signal at once, in order to reduce the computational power requirement of a single transformation (to adapt to the performance of the ring-end MCU).
[0133] Specifically, 1. Segmentation: The collected sleep signal is segmented into 250 sampling points (10 seconds), and each segment is denoted as x[0], x[1], ..., x
[249] .
[0134] 2. DCT-II Transform: Perform Discrete Cosine Transform (DCT-II type) on each segment. The formula is: X[k] =Σ(n=0 toN-1) x[n]·cos[π·k·(2n+1) / (2N)], where N = 250 (segment length), k = 0, 1, 2, ..., 249 (frequency component index), and X[k] is the k-th DCT coefficient.
[0135] 3. Frequency correspondence: The correspondence between DCT coefficient index k and actual frequency: frequency f = k·fs / (2·N) = k·25 / 500 = k·0.05 Hz, for example: k=5→f=0.25Hz (lower limit of respiration); k=100→f=5Hz (upper limit of heart rate).
[0136] 4. Engineering implementation optimization: In the MCU at the ring end, to reduce computational complexity: pre-store cosine lookup table: calculate and store cosine values in advance to avoid real-time calculation; fixed-point approximation: replace floating-point multiplication with integer shift operations; fast DCT algorithm: adopt a divide-and-conquer strategy similar to Fast Fourier Transform (FFT) to reduce O(N²) to O(N·logN).
[0137] 5. Output DCT data segment to obtain 250 DCT coefficients: X[0], X[1], ..., X
[249] . Each coefficient corresponds to the energy intensity of a specific frequency. Subsequently, the coefficients are filtered and compressed according to the frequency band range (0.25-5Hz) and energy threshold.
[0138] In the S820, due to the loss of some high-frequency components during compression, the reconstructed sleep data differs slightly from the original sleep data (e.g., subtle fluctuations in the pulse waveform are smoothed out). This difference reflects the actual signal characteristics the model encounters during edge deployment and is crucial for training the model's resistance to compression interference. Therefore, by decompressing the sleep compressed data, a time-series signal usable for feature extraction (sleep reconstructed data) is restored, while retaining the slight distortions introduced during compression (e.g., loss of high-frequency components, minor amplitude shifts). This allows the model to learn and adapt to these distortions during training, improving its robustness to compressed signals. The distorted signal after compression and decompression of the sleep reconstructed data simulates the actual input at the edge, enabling training the model's robustness against compression.
[0139] In some embodiments of this application, the inverse transform algorithm corresponding to the smart ring compression algorithm is adopted. If the compression is DCT, the decompression adopts the inverse discrete cosine transform (IDCT) to ensure the reversibility and accuracy of the decompression process.
[0140] In the S830, high-quality raw sleep data is fused with reconstructed sleep data that simulates edge-side distortion to construct sleep sample data that combines feature integrity and deployment adaptability. This allows the model to learn complete physiological features while adapting to the distortion of edge-side compressed signals, achieving "alignment between training and deployment domains".
[0141] To save computing power and storage space, the ring-end compresses the PPG signal. If only the original signal is used during training, using the compressed signal during deployment will cause domain shift, leading to performance degradation. Therefore, to adapt to the compressed domain of the ring-end, some embodiments of this application employ a proportional mixing fusion strategy to obtain sleep sample data, allowing the model to adapt to the slight distortion caused by compression. Specifically, refer to the following formula:
[0142] in, This represents the sleep sample data used for training; Represents raw sleep data; This represents the reconstructed sleep data; the formula expresses the fusion ratio of the original sleep data to the reconstructed sleep data. : .
[0143] In some embodiments of this application, the parameters for model training are configured as follows: AdamW optimizer, lr=5e-6, a total of 100 sleep data segments, and int8 values exported after quantization-aware training (QAT).
[0144] Reference Figure 9 As shown, a sleep data processing apparatus 900 according to an embodiment of this application includes: a sleep data acquisition module 910, a first feature representation acquisition module 920, an attention transformation calculation module 930, a dilated convolution module 940, and a sleep cycle determination module 950.
[0145] The sleep data acquisition module 910 is configured to acquire sleep data, which includes multiple sleep data segments, each with a duration less than or equal to a first preset duration. The first feature representation acquisition module 920 is configured to acquire a first feature representation for each sleep data segment. The attention transformation calculation module 930 is configured to perform attention transformation calculations based on the first feature representation of each sleep data segment to obtain a second feature representation for each sleep data segment. The dilated convolution module 940 is configured to perform dilated convolutions on the second feature representations of multiple sleep data segments to determine the sleep stage to which each sleep data segment belongs. The sleep cycle determination module 950 is configured to determine the sleep cycle corresponding to the sleep data based on the sleep stages corresponding to the multiple sleep data segments.
[0146] Reference Figure 10 As shown, a sleep data processing system 1000 according to an embodiment of this application includes a smart ring 1010 and a terminal device 1020.
[0147] The smart ring 1010 is used to divide the acquired sleep signal into multiple sleep signal data segments according to a set length; acquire the discrete cosine transform (DCT) data segments corresponding to the multiple sleep signal data segments; extract the DCT data segments within a set frequency range to obtain key DCT data segments, which include multiple frequency components; extract key frequency components from the multiple frequency components according to the energy corresponding to each of the multiple frequency components to obtain sleep data for sleep analysis, wherein the energy corresponding to the frequency component represents the intensity or contribution of the frequency component in the sleep signal.
[0148] The terminal device 1020 is used to acquire sleep data transmitted by the smart ring 1010. The sleep data includes multiple sleep data segments, and the duration of each sleep data segment is less than or equal to a first set duration. The device acquires a first feature representation of each sleep data segment. Based on the first feature representation of each sleep data segment, the device performs attention transformation calculation to obtain a second feature representation of each sleep data segment. The device performs dilated convolution on the second feature representations of multiple sleep data segments to determine the sleep stage to which each sleep data segment belongs. Based on the sleep stages corresponding to the multiple sleep data segments, the device determines the sleep cycle corresponding to the sleep data.
[0149] In some embodiments of this application, the terminal device 1020 can be a mobile phone, tablet, computer, or other devices.
[0150] Figure 11 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0151] It should be noted that, Figure 11 The computer system 1100 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0152] like Figure 11 As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1102 or programs loaded from storage section 1108 into random access memory (RAM). The RAM 1103 also stores various programs and data required for system operation. The CPU 1101, ROM 1102, and RAM 1103 are interconnected via a bus 1104. An input / output interface 1105 (I / O interface) is also connected to the bus 1104.
[0153] The following components are connected to the input / output interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a local area network card, modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the input / output interface 1105 as needed. Removable media 1111, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on the drive 1110 as needed so that computer programs read from them can be installed into the storage section 1108 as needed.
[0154] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1109, and / or installed from removable medium 1111. When the computer program is executed by central processing unit 1101, it performs various functions defined in the system of this application.
[0155] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0156] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0157] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0158] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0159] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0160] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A sleep data processing method, characterized in that, The method includes: Acquire sleep data, which includes multiple sleep data segments, the duration of each sleep data segment being less than or equal to a first preset duration; Obtain the first feature representation of each sleep data segment; Attention transformation calculation is performed based on the first feature representation of each sleep data segment to obtain the second feature representation of each sleep data segment; The second feature representations of the multiple sleep data segments are subjected to dilated convolution to determine the sleep stage to which each sleep data segment belongs; Based on the sleep stages corresponding to the multiple sleep data segments, the sleep cycle corresponding to the sleep data is determined.
2. The method according to claim 1, characterized in that, The process of performing attention transformation calculations based on the first feature representation of each sleep data segment to obtain the second feature representation of each sleep data segment includes: For each sleep data segment, obtain the valid information within the sleep data segment, as well as the dimension represented by the first feature; Based on the valid information within the sleep data segment, the first feature representation, and the dimension of the first feature representation, a first input feature sequence is obtained by combining them. An attention transformation calculation is performed on the first input feature sequence to obtain the second feature representation of the sleep data segment.
3. The method according to claim 2, characterized in that, The step of performing attention transformation calculation on the first input feature sequence to obtain the second feature representation of the sleep data segment includes: The first input feature sequence is transformed by a linear transformation matrix to obtain the query vector, key vector, and value vector; Calculate the attention score based on the query vector and the key vector; The attention scores are normalized to obtain weight coefficients; The second feature representation of the sleep data segment is obtained based on the weighting coefficients and the value vector.
4. The method according to claim 1, characterized in that, The step of performing dilated convolution on the second feature representations of the multiple sleep data segments to determine the sleep stage to which each sleep data segment belongs includes: Based on the second feature representations of the multiple sleep data segments, a second input feature sequence is obtained by combining them. The second input feature sequence is sequentially dilated by multiple connected convolutional layers to obtain the third feature representations corresponding to the multiple sleep data segments respectively. The convolutional kernels of the multiple convolutional layers increase layer by layer. The third feature representation is a feature representation that integrates the second feature representation of each sleep data segment itself and the temporal dependency relationship of the second feature representations of related sleep data segments. Based on the third feature representation corresponding to each of the multiple sleep data segments, the probability distribution of each sleep stage corresponding to each sleep data segment is obtained, so as to determine the sleep stage to which each sleep data segment belongs.
5. The method according to claim 1, characterized in that, The method further includes: The sleep data is bandpass filtered according to a set spectral range to obtain bandpass filtered sleep data. The set spectral range is determined based on the physiological rhythm frequency of at least one of heart rate and respiratory rate. The bandpass filtered sleep data is divided into multiple sleep data segments according to a second set duration, wherein the second set duration is less than or equal to the first set duration.
6. The method according to claim 1, characterized in that, The acquisition of the first feature representation of each sleep data segment includes: Each sleep data segment is encoded to obtain a candidate feature representation corresponding to each sleep data segment; The candidate feature representation is compressed to obtain the first feature representation.
7. The method according to claim 6, characterized in that, Each sleep data segment includes a photoplethysmography (PPG) signal; the encoding process for each sleep data segment to obtain a candidate feature representation corresponding to each sleep data segment includes: The photoplethysmography signal is subjected to layer-by-layer convolution and downsampling to obtain a two-dimensional feature map, and the two-dimensional feature map is determined as the candidate feature representation. The compression process of the candidate feature representation to obtain the first feature representation includes: The two-dimensional feature map is transformed to obtain a one-dimensional feature vector; The one-dimensional feature vector is transformed to map it into a preset low-dimensional space to obtain an intermediate feature vector. The intermediate feature vector is nonlinearly activated to obtain the first feature representation.
8. The method according to claim 1, characterized in that, Sleep data is obtained through a sleep data processing model, which is trained in the following manner: Acquire sleep sample data, which includes multiple sleep data sample segments, the duration of which is less than or equal to a first set duration; The sleep sample data is input into the model to be trained, and the following steps are performed through the model to be trained: Obtain the first sample feature representation for each sleep data sample segment; Based on each sleep data sample segment, an attention transformation calculation is performed on the first sample feature representation to obtain the second sample feature representation of each sleep data sample segment; The second sample feature representations of the multiple sleep data sample segments are subjected to dilated convolution to determine the predicted sleep stage to which each sleep data sample segment belongs; Based on the predicted sleep stages corresponding to the multiple sleep data sample segments, the predicted sleep cycle corresponding to the sleep sample data is determined. Based on the loss between the predicted sleep cycle and the expected sleep cycle corresponding to the sleep sample data, the model parameters of the model to be trained are adjusted to obtain the sleep data processing model.
9. The method according to claim 8, characterized in that, The acquisition of sleep sample data includes: Receives compressed sleep data sent by the smart ring, wherein the compressed sleep data is obtained by the smart ring compressing the original sleep data; The compressed sleep data is decompressed to obtain reconstructed sleep data; The original sleep data and the reconstructed sleep data are fused to obtain the sleep sample data.
10. A sleep data processing device, characterized in that, The device includes: The sleep data acquisition module is configured to acquire sleep data, which includes multiple sleep data segments, the duration of each sleep data segment being less than or equal to a first preset duration. The first feature representation acquisition module is configured to acquire the first feature representation of each sleep data segment; The attention transformation calculation module is configured to perform attention transformation calculation based on the first feature representation of each sleep data segment to obtain the second feature representation of each sleep data segment; The dilated convolution module is configured to perform dilated convolution on the second feature representations of the multiple sleep data segments to determine the sleep stage to which each sleep data segment belongs; The sleep cycle determination module is configured to determine the sleep cycle corresponding to the sleep data based on the sleep stages corresponding to the multiple sleep data segments.