Nerve network-based drowning early warning method and device, medium and program product
By training a personalized heart rate blood oxygen prediction model, combining the comparison of real-time monitoring data with prediction data, the problem of traditional drowning monitoring methods lacking comprehensive analysis capabilities is solved, and accurate identification and timely warning of drowning risks are achieved.
Patent Information
- Application Number
- CN202510179345.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-03-28
AI Technical Summary
Traditional drowning monitoring methods rely on a single data source and lack comprehensive analysis capabilities, resulting in unsatisfactory early warning results and missed or false alarms.
By training a personalized heart rate blood oxygen prediction model, the neural network model is trained using user's historical data, and combining the comparison of the real-time monitored heart rate blood oxygen data sequence with the predicted data sequence, accurately judge drowning risk.
It has achieved accurate identification and timely warning of drowning risks, effectively prevented drowning accidents, and improved the accuracy and timeliness of drowning risks identification.
Smart Images

Figure FT_1 
Figure FT_2
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a drowning warning method, device, medium and program product based on a neural network. Background Art
[0002] Drowning accidents occur frequently, and traditional monitoring methods have limitations, making it difficult to accurately judge risks in real time. Existing technologies mostly rely on a single data source, lack comprehensive analysis capabilities, and have unsatisfactory early warning effects, with omissions or false alarms. Therefore, there is an urgent need for an early warning method that integrates multi-source data to improve the accuracy and timeliness of drowning risk identification. Summary of the invention
[0003] In view of this, the purpose of the embodiments of the present invention is to provide a drowning warning method, device, medium and program product based on a neural network, train the neural network model through the user's historical data, obtain a personalized heart rate and blood oxygen prediction model, and realize accurate judgment of drowning risk.
[0004] On the one hand, an embodiment of the present invention provides a drowning warning method based on a neural network, the method comprising the following steps:
[0005] Obtaining the user's sampled heart rate and sampled blood oxygen in the most recent detection cycle, preprocessing the sampled heart rate and sampled blood oxygen to obtain the user's heart rate and blood oxygen time series; wherein the heart rate and blood oxygen time series includes a heart rate change sequence and a blood oxygen acceleration sequence;
[0006] The heart rate and blood oxygen time series is input into the heart rate and blood oxygen prediction model to obtain a predicted data sequence of the user in the current detection period; wherein the predicted data sequence includes a predicted heart rate change sequence and a predicted blood oxygen acceleration sequence; the heart rate and blood oxygen prediction model is trained based on the heart rate and blood oxygen time series of the user under multiple different environmental data and motion states;
[0007] Acquire the user's heart rate and blood oxygen data sequence in the current detection cycle, compare the heart rate and blood oxygen data sequence with the predicted data sequence, and determine the drowning risk; wherein the heart rate and blood oxygen data sequence includes a heart rate change sequence and a blood oxygen acceleration sequence.
[0008] Optionally, the acquiring of the sampled heart rate and sampled blood oxygen of the user in the most recent detection cycle, preprocessing the sampled heart rate and sampled blood oxygen to obtain the user's heart rate and blood oxygen time series includes:
[0009] In the most recent detection cycle, heart rate and blood oxygen are collected at the same sampling frequency;
[0010] The heart rate variation value is obtained by performing difference calculation on adjacent heart rates within the detection period, and the heart rate variation value is standardized to form a heart rate variation sequence in chronological order; the blood oxygen acceleration is calculated by performing acceleration calculation on the blood oxygen within the detection period to obtain the blood oxygen acceleration, and the blood oxygen acceleration is standardized to form a blood oxygen acceleration sequence in chronological order; wherein the standardization process includes noise filtering, feature enhancement and normalization process;
[0011] The heart rate change sequence and the blood oxygen acceleration sequence are respectively smoothed by using a sliding window, and the smoothed heart rate change sequence and the blood oxygen acceleration sequence are timestamped to obtain a heart rate and blood oxygen time series.
[0012] Optionally, the heart rate and blood oxygen prediction model is trained in the following way:
[0013] Constructing a dual LSTM model, wherein the dual LSTM model includes a shared encoder, a heart rate decoder, and a blood oxygen acceleration decoder;
[0014] Obtain a training sample set, input the training samples in the training sample set into the dual LSTM model for training, extract the hidden state and cell state of the training samples through the shared encoder, extract features from the hidden state finally output by the shared encoder through the forward propagation method, input the extracted features into the heart rate decoder and the blood oxygen acceleration decoder respectively, output the heart rate prediction value through the heart rate decoder, and output the blood oxygen acceleration prediction value through the blood oxygen acceleration decoder; determine the loss value of the dual LSTM model based on the heart rate prediction value and the blood oxygen acceleration prediction value; wherein the training sample set includes the heart rate and blood oxygen time series of the user in multiple adjacent detection cycles under multiple different environmental data and motion states;
[0015] The dual LSTM model is continuously optimized by a back propagation algorithm until the loss value of the dual LSTM model is lower than a loss threshold, thereby obtaining a heart rate and blood oxygen prediction model.
[0016] Optionally, obtaining a training sample set includes:
[0017] Combine multiple different environmental data and exercise states, and collect the user's heart rate and blood oxygen in each combination; wherein the environmental data includes the lowest water temperature, the average water temperature, the highest water temperature, the lowest air temperature, the average air temperature and the highest air temperature; and the exercise states include extreme speed swimming, slow speed swimming and resting;
[0018] The collected heart rate is calculated by difference to obtain the heart rate change value, and the collected blood oxygen is calculated by acceleration to obtain the blood oxygen acceleration, so as to obtain the heart rate change value and blood oxygen acceleration corresponding to each combination;
[0019] Determine a first detection period corresponding to each of the combinations based on the heart rate variation value, and determine a second detection period corresponding to each of the combinations based on the blood oxygen acceleration;
[0020] Determine a first detection period and a second detection period corresponding to each combination, and take the smaller value of the first detection period and the second detection period as the detection period corresponding to the combination;
[0021] The heart rate and blood oxygen time series of the detection cycle are obtained, the heart rate and blood oxygen time series of adjacent detection cycles are formed into training samples, and multiple training samples are formed into a training sample set.
[0022] Optionally, determining the first detection period corresponding to each of the combinations based on the heart rate change value, and determining the second detection period corresponding to each of the combinations based on the blood oxygen acceleration includes:
[0023] Determine a first-order derivative of the heart rate change value, divide the first-order derivative of the heart rate change value into a plurality of first intervals, determine a combination corresponding to each first interval, and set a first detection period corresponding to the combination, wherein the duration of the first detection period is positively correlated with the size of the first interval;
[0024] Determine the first-order derivative of the blood oxygen acceleration, divide the first-order derivative of the blood oxygen acceleration into multiple second intervals, determine a combination corresponding to each second interval, set a second detection period corresponding to the combination, and the duration of the second detection period is positively correlated with the size of the second interval.
[0025] Optionally, the acquiring of a heart rate and blood oxygen data sequence of the user in a current detection cycle, comparing the heart rate and blood oxygen data sequence with a predicted data sequence, and determining the drowning risk includes:
[0026] Aligning the timestamps of the heart rate and blood oxygen data sequence with the predicted data sequence;
[0027] Calculating a heart rate error and a blood oxygen error corresponding to each timestamp, and determining a physiological threshold of the user based on the heart rate error and the blood oxygen error;
[0028] Acquire current environmental data and reference environmental data, determine an environmental correction factor based on the current environmental data, and adjust the physiological threshold based on the environmental correction factor to obtain a dynamic threshold of the user;
[0029] A drowning risk is determined based on the dynamic threshold.
[0030] Optionally, the acquiring of a heart rate and blood oxygen data sequence of the user in a current detection cycle, comparing the heart rate and blood oxygen data sequence with a predicted data sequence, and determining the drowning risk includes:
[0031] Acquire historical data of the user, and determine a baseline threshold value of the user based on the historical data; wherein the historical data includes a heart rate variation value and a blood oxygen acceleration value of the user in a resting state; and the baseline threshold value includes a baseline heart rate variation value and a baseline blood oxygen acceleration value;
[0032] Acquire a heart rate and blood oxygen data sequence of a current detection cycle, use a sliding window to calculate the exponential moving average of the heart rate change value and the blood oxygen acceleration in the heart rate and blood oxygen data sequence in the current detection cycle, and determine a real-time threshold based on the reference threshold and the exponential moving average; wherein the real-time threshold includes a real-time heart rate change threshold and a real-time blood oxygen acceleration threshold;
[0033] Based on the heart rate and blood oxygen data sequence and the real-time threshold, the heart rate error and blood oxygen error are determined, the heart rate error and blood oxygen error are preprocessed respectively, the mean and standard deviation of the preprocessed heart rate error and blood oxygen error in the most recent detection cycle are calculated respectively, and the physiological threshold is calculated based on the mean and standard deviation; wherein, the preprocessing denoising and outlier removal are included; the heart rate error threshold and the blood oxygen error threshold.
[0034] In another aspect, an embodiment of the present invention provides an electronic device, including:
[0035] at least one processor;
[0036] at least one memory for storing at least one program;
[0037] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0038] On the other hand, an embodiment of the present invention provides a computer-readable storage medium, in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to perform the above method.
[0039] On the other hand, an embodiment of the present invention provides a computer program product, including computer instructions or computer codes, which, when at least part of the computer instructions or the computer codes are executed by a processor, can implement the method described in any one of claim 110.
[0040] The embodiments of the present invention include the following beneficial effects: This embodiment obtains a personalized heart rate and blood oxygen prediction model through training, and trains the model through the user's historical data to obtain a personalized heart rate and blood oxygen prediction model. By real-time monitoring of the user's heart rate and blood oxygen data sequence in the current detection cycle, the real-time monitoring is compared with the predicted data, and abnormal physiological changes are accurately identified, thereby realizing personalized judgment of drowning risk and effectively preventing drowning accidents. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0042] Figure 1 It is a flowchart of a drowning warning method based on a neural network provided by an embodiment of the present invention;
[0043] Figure 2 It is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] It should be noted that although the functional charging modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order than the charging module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0047] like Figure 1 As shown, Figure 1 A drowning warning method based on a neural network is provided in an embodiment of the present invention, and the method comprises the following steps:
[0048] S100, obtaining a sampled heart rate and sampled blood oxygen of a user in a most recent detection cycle, and preprocessing the sampled heart rate and sampled blood oxygen to obtain a heart rate and blood oxygen time series of the user; wherein the heart rate and blood oxygen time series includes a heart rate change series and a blood oxygen acceleration series;
[0049] It should be noted that heart rate refers to the number of times the heart beats per minute and is an important physiological indicator for measuring heart function and physical condition. Blood oxygen saturation refers to the percentage of oxygenated hemoglobin bound to oxygen molecules in the blood to all hemoglobin that can be bound, and is a key indicator for assessing the oxygen supply status of the human body. The normal range of these indicators may vary depending on factors such as age, gender, exercise status, and physical condition.
[0050] Specifically, a swimming cap is worn on the user's head, and a heart rate and blood oxygen sensor is arranged on the swimming cap. The heart rate and blood oxygen sensor collects the user's sampled heart rate and sampled blood oxygen. Every detection cycle,
[0051] After obtaining the user's sampled heart rate and sampled blood oxygen in the most recent detection cycle, the heart rate change sequence and the blood oxygen acceleration sequence are calculated; the heart rate change reflects the magnitude of the heart rate change, and the blood oxygen acceleration reflects the speed of the blood oxygen change. The acceleration value can be positive or negative. When the acceleration is a positive number, it indicates a sharp increase in blood oxygen; when the acceleration is a negative number, it indicates a sharp drop in blood oxygen.
[0052] S200, inputting the heart rate and blood oxygen time series into a heart rate and blood oxygen prediction model to obtain a predicted data sequence of the user in the current detection cycle; wherein the predicted data sequence includes a predicted heart rate change sequence and a predicted blood oxygen acceleration sequence; the heart rate and blood oxygen prediction model is trained based on the heart rate and blood oxygen time series of the user under multiple different environmental data and motion states;
[0053] This embodiment obtains a personalized heart rate and blood oxygen prediction model through training, which can simulate the heart rate and blood oxygen change pattern of the corresponding user; when wearing a swimming cap to collect data, if the detected heart rate and blood oxygen data sequence is inconsistent with the predicted heart rate and blood oxygen data sequence, it means that it is inconsistent with the normal performance of the user, and a drowning warning signal is issued.
[0054] The system starts with the user putting on the swimming cap and provides a full-process risk warning. It can be applied to various stages before the user enters the water, in the water, and after exiting the water. For example, if the swimming cap is fitted before entering the water, some swimmers' heart rate and blood oxygen status can provide a warning of whether they are suitable for entering the water. For example, people with cardiovascular disease, heart disease, myocardial infarction or asthma will trigger a warning based on their physiological condition before entering the water. After exiting the water after exercise, the system will also provide a warning by monitoring the body's physiological condition, allowing full-process health management to be achieved by wearing a swimming cap.
[0055] S300, obtaining a heart rate and blood oxygen data sequence of the user in a current detection cycle, comparing the heart rate and blood oxygen data sequence with a predicted data sequence, and determining the drowning risk; wherein the heart rate and blood oxygen data sequence includes a heart rate change sequence and a blood oxygen acceleration sequence.
[0056] In this embodiment, a full-process risk warning is carried out from the moment the user puts on the swimming cap, and can be applied to various stages such as before the user enters the water, in the water, and after exiting the water. For example, a good swimming cap is worn before entering the water, and the heart rate and blood oxygen status of some swimmers can provide an early warning as to whether they are suitable for entering the water. For example, people with cardiovascular disease, heart disease, myocardial infarction or asthma will trigger an early warning based on their physiological condition before entering the water; after exiting the water after exercise, an early warning will also be issued by monitoring the body's physiological condition, thereby achieving full-process health management by wearing a swimming cap.
[0057] The present invention obtains a personalized heart rate and blood oxygen prediction model that matches the user by training the user's heart rate and blood oxygen time series under multiple different environmental data and motion states; by real-time monitoring of the user's heart rate and blood oxygen data sequence in the current detection cycle, the real-time monitoring is compared with the predicted data, abnormal physiological changes are accurately identified, drowning accidents are effectively prevented, and the swimming experience is improved.
[0058] In some embodiments, in S100, the acquiring of the sampled heart rate and sampled blood oxygen of the user in the most recent detection cycle, preprocessing the sampled heart rate and sampled blood oxygen, and obtaining the user's heart rate and blood oxygen time series includes:
[0059] S110, in a most recent detection cycle, respectively collect heart rate and blood oxygen at the same sampling frequency;
[0060] S120, performing difference calculation on adjacent heart rates within the detection period to obtain a heart rate change value, performing standardization processing on the heart rate change value, and forming a heart rate change sequence in chronological order; performing acceleration calculation on blood oxygen within the detection period to obtain blood oxygen acceleration, performing standardization processing on the blood oxygen acceleration, and forming a blood oxygen acceleration sequence in chronological order; wherein the standardization processing includes noise filtering, feature enhancement and normalization processing;
[0061] S130, using a sliding window to smooth the heart rate change sequence and the blood oxygen acceleration sequence respectively, aligning the timestamps of the smoothed heart rate change sequence and the blood oxygen acceleration sequence to obtain a heart rate and blood oxygen time series.
[0062] In this embodiment, a swimming cap is worn on the user's head, and a heart rate and blood oxygen sensor is arranged on the swimming cap. The user's real-time heart rate and real-time blood oxygen are monitored by the heart rate and blood oxygen sensor. Then, the acceleration is calculated by difference of the blood oxygen saturation value to obtain the heart rate change value; the acceleration is calculated by difference or derivative of the blood oxygen saturation value to obtain the blood oxygen acceleration. Then, the heart rate change value and the blood oxygen acceleration are standardized respectively. Specifically, the motion artifacts are processed based on the improved Savitzky-Golay filter to achieve noise filtering, and the high-frequency noise in the signal is removed by feature enhancement, while the main features of the signal are retained. The dimension effect is eliminated by normalization processing to obtain the heart rate change sequence and blood oxygen acceleration sequence of the detection period. Finally, the heart rate change sequence and blood oxygen acceleration sequence are smoothed respectively through a sliding window to ensure data continuity; the timestamp alignment algorithm (DTW algorithm) is used to align the heart rate change sequence and the blood oxygen acceleration sequence to ensure that the heart rate and blood oxygen acceleration in each sliding window are aligned, thereby accurately capturing the synchronization characteristics of heart rate and blood oxygen changes, and providing high-quality input data for the subsequent drowning warning model.
[0063] In some embodiments, in S200, the heart rate and blood oxygen prediction model is trained in the following manner:
[0064] S210, constructing a dual LSTM model, wherein the dual LSTM model includes a shared encoder, a heart rate decoder, and a blood oxygen acceleration decoder;
[0065] S220, obtaining a training sample set, inputting the training samples in the training sample set into the dual LSTM model for training, extracting the hidden state and cell state of the training samples through the shared encoder, extracting features from the hidden state finally output by the shared encoder through a forward propagation method, inputting the extracted features into a heart rate decoder and a blood oxygen acceleration decoder respectively, outputting a heart rate prediction value through the heart rate decoder, and outputting a blood oxygen acceleration prediction value through the blood oxygen acceleration decoder; determining a loss value of the dual LSTM model based on the heart rate prediction value and the blood oxygen acceleration prediction value; wherein the training sample set includes a user's heart rate and blood oxygen time series in multiple adjacent detection cycles under multiple different environmental data and motion states;
[0066] In this embodiment, different environmental data (water temperature, air temperature) and exercise states (speed swimming, slow swimming, resting, etc.) are taken into account to affect the user's blood oxygen. For example, cold waters may cause a decrease in blood oxygen saturation. By analyzing the relationship between these environmental factors and changes in heart rate and blood oxygen, the user's heart rate and blood oxygen data in extreme situations are obtained, and a heart rate and blood oxygen prediction model suitable for a variety of environments and exercise states is established to simulate the change pattern of the user in extreme situations. Since each user's heart rate and blood oxygen change pattern is different, by testing the user's heart rate and blood oxygen, the user's training sample is obtained, and the trained heart rate and blood oxygen prediction model can be more personalized to adapt to the user's physical function, improving the accuracy of subsequent drowning warnings.
[0067] Specifically, taking a training sample as an example, the training sample includes the heart rate and blood oxygen time series of the user in the most recent detection cycle and the heart rate and blood oxygen time series of the current detection cycle; obtaining the actual heart rate value corresponding to the heart rate prediction value and the actual blood oxygen acceleration value corresponding to the blood oxygen acceleration prediction value, and calculating the loss value of the dual LSTM model through the heart rate prediction value and the corresponding heart rate actual value, the blood oxygen acceleration prediction value and the corresponding blood oxygen acceleration actual value;
[0068] S230, continuously optimizing the dual LSTM model through a back propagation algorithm until the loss value of the dual LSTM model is lower than a loss threshold, thereby obtaining a heart rate and blood oxygen prediction model.
[0069] By adopting a shared encoder + dual decoder structure, the time series features are extracted through the shared encoder, and then the predicted values of heart rate and blood oxygen acceleration are output through two decoders respectively, taking into account both feature reuse and independent prediction requirements, and being used to simultaneously predict heart rate and blood oxygen acceleration.
[0070] There is a strong correlation between heart rate change values and blood oxygen acceleration in drowning scenarios (such as hypoxia leading to a compensatory increase in heart rate). The shared encoder can automatically learn the dynamic coupling relationship between the two; through the LSTM gating mechanism, it simultaneously models short-term mutations (such as a sudden drop in blood oxygen) and long-term trends (such as a continuous increase in heart rate) of heart rate and blood oxygen, thereby achieving accurate prediction of the user's health status, issuing early warning signals in a timely manner, effectively preventing accidents such as drowning, and ensuring the user's life safety.
[0071] Through the sharing mechanism of the shared encoder, the heart rate and blood oxygen data are generated into a unified feature representation, and the common features in the heart rate and blood oxygen data can be learned at the same time, improving the generalization ability and prediction performance of the heart rate and blood oxygen prediction model; through parameter sharing, the number of parameters is reduced, the training efficiency is improved, and the implicit regularization effect is produced through dual-task joint training, which improves the convergence speed, training efficiency, and reduces computing resource consumption. The dual LSTM model provided by the present invention is suitable for wearable device scenarios, and can achieve a balance between real-time, low power consumption and high precision by sharing the underlying feature extractor under the condition of limited computing resources.
[0072] In some embodiments, the input dimension of the shared encoder is 2 (heart rate variability value and blood oxygen acceleration), the hidden layer size is 64, and the number of layers is 3.
[0073] The heart rate decoder and blood oxygen acceleration decoder are both sequential networks. The heart rate decoder is used to decode the heart rate prediction value from the hidden state of LSTM, and the blood oxygen acceleration decoder is used to decode the blood oxygen acceleration prediction value from the hidden state of LSTM. The decoder structure is the same as that of the heart rate decoder, including:
[0074] First layer: The first linear layer maps the input 64-dimensional features to 32 dimensions.
[0075] The second layer: ReLU activation function is used to introduce nonlinearity.
[0076] The third layer: the second linear layer, which maps the 32-dimensional features to 1-dimensional and outputs the heart rate prediction value.
[0077] In some embodiments, in S220, obtaining a training sample set includes:
[0078] S221, combining a plurality of different environmental data and exercise states, and collecting the user's heart rate and blood oxygen respectively in each combination; wherein the environmental data includes the lowest water temperature, the average water temperature, the highest water temperature, the lowest air temperature, the average air temperature and the highest air temperature; and the exercise states include extreme speed swimming, slow speed swimming and resting;
[0079] Specifically, a full factorial experimental design method is used to generate the combination of environmental data and motion status:
[0080] Water temperature parameters: minimum water temperature (12℃~35℃), average water temperature, maximum water temperature (step length 5℃);
[0081] Temperature parameters: minimum temperature (-10℃~45℃), average temperature, maximum temperature (step length 5℃);
[0082] Movement status: extreme speed swimming (≥2.5m / s), slow speed swimming (0.8~1.5m / s), resting (0m / s);
[0083] Generate 5,832 basic combinations (6 environmental parameters × 3 motion states × 6 water temperature gradients × 6 air temperature gradients)
[0084] The sampling time of each experiment is ≥30 minutes, the sampling frequency is 10Hz, and the user's heart rate and blood oxygen are collected in each combination.
[0085] S222, performing difference calculation on the collected heart rate to obtain a heart rate change value, performing acceleration calculation on the collected blood oxygen to obtain a blood oxygen acceleration, and obtaining a heart rate change value and a blood oxygen acceleration corresponding to each combination;
[0086] Specifically, the heart rate change value (ΔHR) was calculated using a sliding window difference algorithm with a window size of N = 30 (corresponding to a 3-second physiological response delay), and the heart rate change value ΔHR was Z-score standardized to eliminate individual baseline differences;
[0087] The calculation of blood oxygen acceleration (αSpO2) is based on the second-order central difference method, with a sampling time interval of Δt = 0.1 second (matching a 10 Hz sampling rate), and the acceleration value is subjected to a Butterworth low-pass filter (cutoff frequency 2 Hz) to smooth high-frequency noise and ensure data accuracy.
[0088] S223, determining a first detection period corresponding to each of the combinations based on the heart rate change value, and determining a second detection period corresponding to each of the combinations based on the blood oxygen acceleration;
[0089] S224, determining a first detection period and a second detection period corresponding to each combination, and taking the smaller value of the first detection period and the second detection period as the detection period corresponding to the combination;
[0090] S225, obtaining the heart rate and blood oxygen time series of the detection period, forming the heart rate and blood oxygen time series of adjacent detection periods into training samples, and forming a training sample set from multiple training samples.
[0091] In this embodiment, different environmental data (water temperature, air temperature) and exercise states (speed swimming, slow swimming, resting, etc.) are taken into account to affect the user's blood oxygen. For example, cold waters may cause a decrease in blood oxygen saturation. By analyzing the relationship between these environmental factors and changes in heart rate and blood oxygen, the user's heart rate and blood oxygen data in extreme situations are obtained, and a heart rate and blood oxygen prediction model suitable for a variety of environments and exercise states is established to simulate the change pattern of users in extreme situations. By setting the length of the corresponding detection cycle for different combinations, it is ensured that the model can accurately capture the trend of heart rate and blood oxygen changes in different exercise states. By adopting a dynamic time window mechanism, the input sequence length (30s-120s) is automatically adjusted according to the user's exercise intensity. Combined with historical data, it is applied to the dual LSTM model for training to improve prediction accuracy.
[0092] In some embodiments, in S223, determining the first detection period corresponding to each of the combinations based on the heart rate variation value, and determining the second detection period corresponding to each of the combinations based on the blood oxygen acceleration, includes:
[0093] Determine a first-order derivative of the heart rate change value, divide the first-order derivative of the heart rate change value into a plurality of first intervals, determine a combination corresponding to each first interval, and set a first detection period corresponding to the combination, wherein the duration of the first detection period is positively correlated with the size of the first interval;
[0094] Determine the first-order derivative of the blood oxygen acceleration, divide the first-order derivative of the blood oxygen acceleration into multiple second intervals, determine a combination corresponding to each second interval, set a second detection period corresponding to the combination, and the duration of the second detection period is positively correlated with the size of the second interval.
[0095] In this embodiment, by using the gradient of dynamic changes in heart rate and blood oxygen, the detection cycle is optimized and adjusted to further improve the sensitivity and accuracy of monitoring.
[0096] In some embodiments, in S300, obtaining a heart rate and blood oxygen data sequence of a user in a current detection cycle, comparing the heart rate and blood oxygen data sequence with a predicted data sequence, and determining a drowning risk includes:
[0097] S310, aligning the timestamps of the heart rate and blood oxygen data sequence and the predicted data sequence;
[0098] S320, calculating the heart rate error and blood oxygen error corresponding to each timestamp, and determining the user's physiological threshold based on the heart rate error and blood oxygen error;
[0099] S330, obtaining current environmental data and reference environmental data, determining an environmental correction factor based on the current environmental data, and adjusting the physiological threshold based on the environmental correction factor to obtain a dynamic threshold of the user;
[0100] In this embodiment, water temperature and air temperature are introduced to dynamically adjust the physiological threshold. The benchmark environmental data includes the benchmark water temperature and the benchmark air temperature. Taking water temperature as an example, assuming that 25°C is the benchmark water temperature Twater, the threshold is relaxed by 3% for every 1°C increase. The difference between the current water temperature and the benchmark water temperature is calculated, and the water temperature correction factor is calculated using the formula (1+β*(Twater-25)), β=0.03; similarly, the air temperature correction factor is calculated, and the product of the water temperature correction factor and the air temperature correction factor is used as the environmental correction factor, and the product of the environmental correction factor and the physiological threshold is used as the user's dynamic threshold. By performing dynamic threshold processing on the heart rate error and blood oxygen error, the threshold is dynamically adjusted according to the distribution of the error to avoid the limitations brought by fixed thresholds.
[0101] S340: Determine the drowning risk based on the dynamic threshold.
[0102] Specifically, if the heart rate error and blood oxygen error are both lower than the dynamic threshold, it is judged as low risk; as the heart rate error and blood oxygen error increase, the drowning risk gradually increases. If either error exceeds the dynamic threshold, the risk level is increased, the emergency response mechanism is activated, the rescue personnel are automatically notified, and a warning sound is issued to remind the user. Through this mechanism, the user's physiological state can be monitored in real time to effectively prevent drowning accidents.
[0103] In some embodiments, in S320, obtaining a heart rate and blood oxygen data sequence of the user in the current detection cycle, comparing the heart rate and blood oxygen data sequence with a predicted data sequence, and determining the drowning risk includes:
[0104] S321, obtaining historical data of the user, and determining a baseline threshold value of the user based on the historical data; wherein the historical data includes a heart rate variation value and a blood oxygen acceleration value of the user in a resting state; and the baseline threshold value includes a baseline heart rate variation value and a baseline blood oxygen acceleration value;
[0105] Specifically, the heart rate and blood oxygen data sequence of the user who has been training in a resting state in the last 30 days is obtained, and a reference heart rate and blood oxygen data sequence is obtained by median operation as the user's personalized baseline;
[0106] S322, obtaining a heart rate and blood oxygen data sequence of the current detection period, using a sliding window to calculate the exponential moving average of the heart rate change value and the blood oxygen acceleration in the heart rate and blood oxygen data sequence in the current detection period, and determining a real-time threshold based on the reference threshold and the exponential moving average; wherein the real-time threshold includes a real-time heart rate change threshold and a real-time blood oxygen acceleration threshold;
[0107] Specifically, taking the real-time heart rate change threshold as an example, the calculation formula of the real-time heart rate change threshold is: HRdynamic(t)=α*HRbase+(1-α)*EMA(HR t-60:t ), where HRdynamic(t) represents the real-time heart rate change threshold, t is the duration of the detection cycle, HRbase is the baseline heart rate change value, EMA is the exponential moving average, and HR t-60:t Indicates the heart rate change value of the current detection cycle, α is the empirical coefficient, α=0.2.
[0108] In this embodiment, based on the current motion state (classified as rest / slow swimming / fast swimming through accelerometer data), a sliding window (window size 60 seconds) is used to calculate the dynamic baseline, which changes with the user's real-time activity state. When the user is at rest, the baseline is close to the heart rate and blood oxygen data in the resting state; when the user starts to exercise, especially when doing strenuous exercise, the dynamic baseline will be adjusted according to the data in the sliding window, thereby reflecting the user's immediate physiological state. In this way, by comparing the actual monitoring data with the dynamic baseline, the user's physiological abnormalities at different activity levels can be more accurately identified, providing a more scientific basis for drowning risk assessment.
[0109] S323, determine the heart rate error and blood oxygen error based on the heart rate and blood oxygen data sequence and the real-time threshold, preprocess the heart rate error and blood oxygen error respectively, calculate the mean and standard deviation of the preprocessed heart rate error and blood oxygen error in the most recent detection cycle respectively, and obtain the physiological threshold based on the mean and standard deviation; wherein, the preprocessing denoising and outlier removal are included; the heart rate error threshold and the blood oxygen error threshold.
[0110] Specifically, the heart rate error is determined based on the heart rate change value sequence and the heart rate change threshold in the heart rate and blood oxygen data sequence, and the blood oxygen error is determined based on the blood oxygen acceleration sequence and the baseline blood oxygen acceleration in the heart rate and blood oxygen data sequence; taking the heart rate error threshold as an example, the calculation formula of the heart rate error threshold is: TheHR(t)=μHR(t)+2.5*σHR(t); wherein, the heart rate error threshold, represents the mean, and represents the standard deviation.
[0111] The present invention comprehensively considers the changes in heart rate and blood oxygen acceleration, and can more accurately assess the risk through multi-dimensional fusion and time series continuity verification. The solution provided by the present invention is compared with the traditional threshold method for drowning risk warning, and the conclusions are shown in the following table:
[0112] index This program Traditional threshold method Detection rate 98.2% 73.6% False alarm rate / hour 0.3 2.8 Response delay (ms) 120 300
[0113] By comparison, it can be seen that this solution is significantly better than the traditional threshold method in terms of detection rate, false alarm rate and response delay, effectively improving the accuracy and timeliness of drowning warnings and providing more reliable protection for swimmers' safety. In addition, this solution also has adaptive learning capabilities, which can continuously optimize the model based on real-time user data, further reduce the false alarm rate, and ensure the stability and reliability of the warning system. Through continuous learning and data accumulation, the model can more accurately capture individual differences, achieve personalized warnings, and greatly enhance the pertinence and effectiveness of drowning protection.
[0114] See also Figure 2 , an embodiment of the present invention provides an electronic device, including:
[0115] at least one processor;
[0116] at least one memory for storing at least one program;
[0117] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0118] It can be seen that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0119] In addition, the embodiment of the present application also discloses a computer program product or a computer program, and the computer program product or the computer program is stored in a computer-readable storage medium. The processor of the computer device can read the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device performs the above method. Similarly, the contents in the above method embodiment are all applicable to the storage medium embodiment, and the functions specifically implemented by the storage medium embodiment are the same as those in the above method embodiment, and the beneficial effects achieved are also the same as those achieved by the above method embodiment.
[0120] In addition, the embodiment of the present application also provides a computer program product, including computer instructions or computer codes, which can implement the above method when at least part of the computer instructions or computer codes are executed by a processor. In some embodiments, the computer program product may only involve computer instructions or computer codes, which may be carried by a storage medium or a processing device. In other embodiments, the computer program product may also be a storage medium or a processing device containing the aforementioned computer instructions or computer codes. The processing device may include one or more processors, and a storage medium.
[0121] It will be appreciated by those skilled in the art that all or some of the systems in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0122] The preferred embodiments of the present application are described above with reference to the accompanying drawings, but the scope of the rights of the present application is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present application should be within the scope of the rights of the present application.
Claims
1. A drowning warning method based on neural network, characterized in that: The method comprises the following steps: Obtaining the user's sampled heart rate and sampled blood oxygen in the most recent detection cycle, preprocessing the sampled heart rate and sampled blood oxygen to obtain the user's heart rate and blood oxygen time series; wherein the heart rate and blood oxygen time series includes a heart rate change sequence and a blood oxygen acceleration sequence; The heart rate and blood oxygen time series is input into the heart rate and blood oxygen prediction model to obtain a predicted data sequence of the user in the current detection period; wherein the predicted data sequence includes a predicted heart rate change sequence and a predicted blood oxygen acceleration sequence; the heart rate and blood oxygen prediction model is trained based on the heart rate and blood oxygen time series of the user under multiple different environmental data and motion states; Acquire the user's heart rate and blood oxygen data sequence in the current detection cycle, compare the heart rate and blood oxygen data sequence with the predicted data sequence, and determine the drowning risk; wherein the heart rate and blood oxygen data sequence includes a heart rate change sequence and a blood oxygen acceleration sequence.
2. The method according to claim 1, characterized in that The step of obtaining the sampled heart rate and sampled blood oxygen of the user in the most recent detection cycle, and preprocessing the sampled heart rate and sampled blood oxygen to obtain the user's heart rate and blood oxygen time series includes: In the most recent detection cycle, heart rate and blood oxygen are collected at the same sampling frequency; The heart rate variation value is obtained by performing difference calculation on adjacent heart rates within the detection period, and the heart rate variation value is standardized to form a heart rate variation sequence in chronological order; the blood oxygen acceleration is calculated by performing acceleration calculation on the blood oxygen within the detection period to obtain the blood oxygen acceleration, and the blood oxygen acceleration is standardized to form a blood oxygen acceleration sequence in chronological order; wherein the standardization process includes noise filtering, feature enhancement and normalization process; The heart rate change sequence and the blood oxygen acceleration sequence are respectively smoothed by using a sliding window, and the smoothed heart rate change sequence and the blood oxygen acceleration sequence are timestamped to obtain a heart rate and blood oxygen time series.
3. The method according to claim 1, characterized in that The heart rate and blood oxygen prediction model is trained in the following way: Constructing a dual LSTM model, wherein the dual LSTM model includes a shared encoder, a heart rate decoder, and a blood oxygen acceleration decoder; Obtain a training sample set, input the training samples in the training sample set into the dual LSTM model for training, extract the hidden state and cell state of the training samples through the shared encoder, extract features from the hidden state finally output by the shared encoder through a forward propagation method, input the extracted features into a heart rate decoder and a blood oxygen acceleration decoder respectively, output a heart rate prediction value through the heart rate decoder, and output a blood oxygen acceleration prediction value through the blood oxygen acceleration decoder; Determine the loss value of the dual LSTM model based on the heart rate prediction value and the blood oxygen acceleration prediction value; wherein the training sample set includes the heart rate and blood oxygen time series of the user in multiple adjacent detection cycles under multiple different environmental data and motion states; The dual LSTM model is continuously optimized by a back propagation algorithm until the loss value of the dual LSTM model is lower than a loss threshold, thereby obtaining a heart rate and blood oxygen prediction model.
4. The method according to claim 3, characterized in that The step of obtaining a training sample set includes: Combine multiple different environmental data and exercise states, and collect the user's heart rate and blood oxygen in each combination; wherein the environmental data includes the lowest water temperature, the average water temperature, the highest water temperature, the lowest air temperature, the average air temperature and the highest air temperature; and the exercise states include extreme speed swimming, slow speed swimming and resting; The collected heart rate is calculated by difference to obtain the heart rate change value, and the collected blood oxygen is calculated by acceleration to obtain the blood oxygen acceleration, so as to obtain the heart rate change value and blood oxygen acceleration corresponding to each combination; Determine a first detection period corresponding to each of the combinations based on the heart rate variation value, and determine a second detection period corresponding to each of the combinations based on the blood oxygen acceleration; Determine a first detection period and a second detection period corresponding to each combination, and take the smaller value of the first detection period and the second detection period as the detection period corresponding to the combination; The heart rate and blood oxygen time series of the detection cycle are obtained, the heart rate and blood oxygen time series of adjacent detection cycles are formed into training samples, and multiple training samples are formed into a training sample set.
5. The method according to claim 4, characterized in that The determining of the first detection period corresponding to each of the combinations based on the heart rate variation value, and the determining of the second detection period corresponding to each of the combinations based on the blood oxygen acceleration, comprises: Determine a first-order derivative of the heart rate change value, divide the first-order derivative of the heart rate change value into a plurality of first intervals, determine a combination corresponding to each first interval, and set a first detection period corresponding to the combination, wherein the duration of the first detection period is positively correlated with the size of the first interval; Determine the first-order derivative of the blood oxygen acceleration, divide the first-order derivative of the blood oxygen acceleration into multiple second intervals, determine a combination corresponding to each second interval, set a second detection period corresponding to the combination, and the duration of the second detection period is positively correlated with the size of the second interval.
6. The method according to claim 1, characterized in that The step of obtaining a heart rate and blood oxygen data sequence of the user in the current detection cycle, comparing the heart rate and blood oxygen data sequence with a predicted data sequence, and determining the drowning risk includes: Aligning the timestamps of the heart rate and blood oxygen data sequence with the predicted data sequence; Calculating a heart rate error and a blood oxygen error corresponding to each timestamp, and determining a physiological threshold of the user based on the heart rate error and the blood oxygen error; Acquire current environmental data and reference environmental data, determine an environmental correction factor based on the current environmental data, and adjust the physiological threshold based on the environmental correction factor to obtain a dynamic threshold of the user; A drowning risk is determined based on the dynamic threshold.
7. The method according to claim 6, characterized in that The step of obtaining a heart rate and blood oxygen data sequence of the user in the current detection cycle, comparing the heart rate and blood oxygen data sequence with a predicted data sequence, and determining the drowning risk includes: Acquire historical data of the user, and determine a baseline threshold value of the user based on the historical data; wherein the historical data includes a heart rate variation value and a blood oxygen acceleration value of the user in a resting state; and the baseline threshold value includes a baseline heart rate variation value and a baseline blood oxygen acceleration value; Acquire a heart rate and blood oxygen data sequence of a current detection cycle, use a sliding window to calculate the exponential moving average of the heart rate change value and the blood oxygen acceleration in the heart rate and blood oxygen data sequence in the current detection cycle, and determine a real-time threshold based on the reference threshold and the exponential moving average; wherein the real-time threshold includes a real-time heart rate change threshold and a real-time blood oxygen acceleration threshold; Based on the heart rate and blood oxygen data sequence and the real-time threshold, the heart rate error and blood oxygen error are determined, the heart rate error and blood oxygen error are preprocessed respectively, the mean and standard deviation of the preprocessed heart rate error and blood oxygen error in the most recent detection cycle are calculated respectively, and the physiological threshold is calculated based on the mean and standard deviation; wherein, the preprocessing denoising and outlier removal are included; the heart rate error threshold and the blood oxygen error threshold.
8. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 7.
9. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to perform the method according to any one of claims 1 to 7 when executed by the processor.
10. A computer program product, characterized in that The method comprises computer instructions or computer codes, and when at least part of the computer instructions or the computer codes are executed by a processor, the method according to any one of claims 1 to 7 can be implemented.
Citation Information
Cited By
Rehabilitation exercise information monitoring method for cerebral palsy patient based on wearable device
CN120036774A