Federal learning-based air pressure control method for predictive driving type household breathing machine

Optimizing the pressure control of household ventilators through federal learning and double-layer long and short-term memory network model, solving the problems of individual differences and model generalization capabilities, and realizing personalized pressure regulation and precise treatment.

CN120412958APending Publication Date: 2025-08-01ZHAOQING UNIV +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510571762.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

The air pressure output algorithm of existing household ventilators is difficult to provide precise treatment for individual differences, resulting in insufficient treatment or excessive intervention, and the neural network model of a single device lacks generalization ability and adaptability, affecting the treatment effect and comfort.

Method used

Using a predictively driven air pressure control method based on federated learning, a double-layer long and short-term memory network model is constructed, combined with an adaptive moment estimation optimizer and differentiated population loss function, the coordinated work between the cloud and the ventilator is used to optimize the tidal volume prediction model and adjust the air pressure output in real time.

Benefits of technology

On the premise of ensuring data privacy, the prediction accuracy and control performance of the ventilator are improved, personalized air pressure regulation is achieved, adapting to respiratory events in different patient groups, and improving treatment effect and comfort.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120412958A_ABST
    Figure CN120412958A_ABST
Patent Text Reader

Abstract

The invention discloses a federated learning-based air pressure control method for a predictive drive type household respirator, which relates to the technical field of household sleep respirators and comprises the following steps of: training a double-layer long-short-term memory network model by using a self-adaptive moment estimation optimizer to obtain a tidal volume prediction model; aggregation optimization is carried out on the tidal volume prediction models of the breathing machine ends through federal learning, and an optimized global tidal volume prediction model is obtained; the physiological data collected by the respirator end in real time are predicted, and the tidal volume of the patient is obtained; the air pressure output of the breathing machine is adjusted based on the tidal volume. Through cooperative work of the cloud end and the breathing machine end, the neural network model is optimized by using the federated learning algorithm, on the premise of ensuring data privacy, the prediction precision and control performance of the breathing machine are continuously improved, the model used in the breathing machine can be ensured to be more accurately matched with breathing events of different groups, and the breathing efficiency is improved. And the prediction precision and the control effect are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of household sleep ventilators. Specifically, it relates to a prediction-driven household ventilator air pressure control method based on federated learning. Background Art

[0002] Obstructive sleep apnea hypopnea syndrome (OSAHS) is a common sleep breathing disorder, whose main feature is that during sleep, due to repeated collapse or partial obstruction of the upper airway, apnea or hypopnea occurs, thereby causing intermittent hypoxemia and sleep fragmentation. As a means of positive airway pressure ventilation, household ventilators are one of the main devices for treating obstructive sleep apnea. The treatment of the ventilator depends on accurately identifying the current state of the patient and providing ventilation support at an appropriate time. If the current respiratory state of the patient cannot be accurately identified, it may cause the air pressure output of the ventilator to fail to open the patient's airway, resulting in the patient experiencing a long period of hypoxic state, exacerbating sympathetic nerve excitement and sleep structure disorder.

[0003] Existing studies have shown that there are certain differences in the patterns of obstructive sleep apnea occurring at night among patients with different physiological signs. For example, factors such as an individual's BMI, age, and airway anatomical structure may all affect the occurrence frequency, duration, and severity of their respiratory events. However, traditional air pressure output algorithms mainly rely on statistical methods to find the commonalities of patients and adjust the air pressure according to preset rules, making it difficult to provide precise treatment for individual differences. This approach may lead to under-treatment or over-intervention in some patient groups, affecting the ventilation effect and patient comfort. Therefore, there is an urgent need for an intelligent air pressure control algorithm that can fully consider the individual physiological characteristic differences of patients and achieve precise adaptive adjustment to optimize the treatment effect.

[0004] Although neural network algorithms can reduce the lag of traditional rule algorithms and improve prediction accuracy, the neural network model of a single ventilator often faces problems of data limitation and insufficient adaptability. Due to privacy considerations of patients, patients do not want their data to be uploaded to the cloud for sharing. If only the sleep data of a single patient is used, the model will lack generalization ability and the ability to further learn, making the model may not be able to fully adapt to the personalized needs of different patients. Furthermore, due to the different usage environments and health conditions of patients, the optimized model of a single device may encounter overfitting or be unable to cope with complex changes in actual applications, affecting the stability of the treatment effect.

[0005] The commonly used pressure outputs in home ventilators are continuous positive airway pressure ventilation (CPAP) and auto-adjusting positive airway pressure ventilation (APAP). However, after such data-driven rule algorithms in ventilators rely on sensors to obtain patients' respiratory data and then change the output pressure of the ventilator, there is a lag of 1 s to 2 s between the air pressure output and the start of the patient's respiratory event, making it impossible for the pressure adjustment to synchronously adapt to the patient's real-time respiratory changes, thus affecting the treatment effect and comfort level.

[0006] Regarding the problems in the related technologies, no effective solutions have been proposed yet. Summary of the Invention

[0007] Regarding the problems in the related technologies, the present invention proposes a prediction-driven home ventilator air pressure control method based on federated learning to overcome the above-mentioned technical problems existing in the existing related technologies.

[0008] For this purpose, the specific technical solutions adopted by the present invention are as follows: A prediction-driven home ventilator air pressure control method based on federated learning, comprising: S1. Obtain the physiological data of the patient, construct a double-layer long short-term memory network model based on the physiological data, and use the adaptive moment estimation optimizer to train the double-layer long short-term memory network model to obtain a tidal volume prediction model; S2. Upload the weights of the tidal volume prediction model to the cloud, and aggregate and optimize the tidal volume prediction models of several ventilator terminals through federated learning to obtain an optimized global tidal volume prediction model, and send the optimized tidal volume prediction model to each ventilator terminal for update; S3. Based on the tidal volume prediction model, predict the physiological data collected in real time at the ventilator terminal to obtain the tidal volume of the patient; and adjust the air pressure output of the ventilator based on the tidal volume.

[0009] Further, obtaining the physiological data of the patient, constructing a double-layer long short-term memory network model based on the physiological data, and using the adaptive moment estimation optimizer to train the double-layer long short-term memory network model to obtain a tidal volume prediction model includes: S11. Obtain the physiological data of the patient, normalize the physiological data, and map it to a preset interval; S12. Based on the processed physiological data, construct a first layer as a long short-term memory network layer, and use the rectified linear unit as the activation function, and set to return the complete time series; S13. Construct a second layer as a dropout layer, and preset a dropout rate to randomly mask the outputs of some neurons; S14. Construct a third layer as a long short-term memory network layer, and use the rectified linear unit as the activation function, and set to return the complete time series; S15. Construct a fourth layer as a dropout layer and preset a dropout rate; S16. Construct a fifth layer as a global average pooling 1D layer, and perform global average pooling operation on the time series data output by the previous long short-term memory network layer through the global average pooling 1D layer, average over all time steps on all feature dimensions, and generate a feature vector with a fixed length; S17. Construct a sixth layer as a fully connected layer, and process the feature vector output by the previous global average pooling 1D layer through the fully connected layer to generate a tidal volume prediction value of a neuron, and obtain a double-layer long short-term memory network model; S18. Use the Adam optimizer to train the double-layer long short-term memory network model, and perform end-to-end training in combination with the differential group loss function, and finally train to obtain a tidal volume prediction model.

[0010] Further, using the Adam optimizer to train the double-layer long short-term memory network model, and performing end-to-end training in combination with the differential group loss function, finally training to obtain a tidal volume prediction model includes: S181. Use the Adam optimizer to calculate the gradient of the double-layer long short-term memory network model respectively, update the first moment and the second moment, and perform bias correction and parameter update; S182. In each iteration, calculate the gradient vector based on the current parameters and the loss function, and provide the required gradient information for subsequent parameter updates; S183. Update the first moment, smooth the gradient by weighting the historical gradient direction and using an exponential decay rate to obtain an estimate of the current gradient direction; S184. Update the second moment, adjust the learning rate of the gradient by taking a weighted average of the squared gradient to adapt to different gradient changes; S185. Perform bias correction on the first moment and the second moment to eliminate the zero-value bias at the initial moment; S186. Use the corrected first moment and second moment to adjust the parameter update step size and update the parameters to ensure that the model parameters gradually approach the optimal value; S187. Combine the differential group loss function, process data of different groups during the training of the double-layer long short-term memory network model, and calculate the weighted loss for the current group and the non-current group respectively; S188. Through the differential group loss function, process the prediction errors of the current group and the non-current group differently, and adjust the weighted coefficients of the loss function; S189. Complete the training and finally obtain a tidal volume prediction model.

[0011] Further, the formula for calculating the gradient of the double-layer long short-term memory network model is: ; The formula for updating the first moment is: ; The formula for updating the second moment is: ; The formulas for bias correction of the first moment and the second moment are respectively: ; ; The formula for using the corrected first moment and second moment to adjust the parameter update step size is: ; In the formula, z represents the number of iterations; g z represents the gradient calculated in the z-th iteration; θ z-1 represents the parameter after the (z - 1)-th iteration; f(θ z-1 ) represents the value of the loss function at the parameter θ z-1 ; represents the operation of taking the gradient of the parameter θ; m z represents the first moment of the z-th iteration; m z-1 represents the first moment of the (z - 1)-th iteration; β1 represents the exponential decay rate of the first moment; v z represents the second moment of the z-th iteration; v z-1 represents the second moment of the (z - 1)-th iteration; β2 represents the exponential decay rate of the second moment; g z 2 represents the element-wise square of the gradient g z ; represents the corrected first moment; represents the corrected second moment; represents the z-th power of the exponential decay rate of the first moment; represents the z-th power of the exponential decay rate of the second moment; θ z represents the updated parameter; α represents the learning rate; represents taking the element-wise square root of the corrected second moment; ε represents a very small positive number.

[0012] Furthermore, the formula for the differential group loss function is: ; In the formula, N represents the total number of samples; S represents the current group; D represents the non-current group; N S represents the total number of samples in the current group; N D represents the total number of samples in the non-current group; α represents the weight coefficient of the current group; β represents the weight coefficient of the non-current group; y sIndicates the actual tidal volume value of the current group; y d Indicates the true tidal volume value of the non-current group; μ s Indicates the predicted tidal volume value of the current group; μ d represents the predicted tidal volume value of the non-current group; σ s represents the prediction variance of the current group; σ d Represents the predicted variance of the non-current group; γ represents the adversarial penalty coefficient; ε represents a very small positive number.

[0013] Furthermore, the weights of the tidal volume prediction model are uploaded to the cloud, and the tidal volume prediction models of several ventilator terminals are aggregated and optimized through federated learning to obtain an optimized global tidal volume prediction model. The optimized tidal volume prediction model is then distributed to each ventilator terminal for update, including: S21. Initialize the cloud server and check whether a tidal volume prediction model already exists. If so, directly transmit it to the ventilator client; otherwise, enter the subsequent training phase; S22: Determine whether the cloud server is awakened by the ventilator client. If so, the cloud server enters federated learning; otherwise, the federated learning is skipped. S23. The cloud server extracts airway flow velocity characteristic data from the polysomnography data and normalizes the airway flow velocity characteristic data; S24. Arrange the tidal volume data according to time sequence, and divide the tidal volume data into a training set and a test set; S25. Combining the current group and non-current group of different populations and using the federated average algorithm of differentiated population classification to train the tidal volume prediction model; S26. Use the trained tidal volume prediction model to predict the patient's airway flow velocity characteristic data to obtain a predicted tidal volume value, and calculate the coefficient of determination between the predicted value and the true value to evaluate the performance of the tidal volume prediction model; S27. Upload the weights of the tidal volume prediction models of each ventilator end to the cloud, aggregate and optimize the tidal volume prediction models of each ventilator end through federated learning, and generate a globally optimized tidal volume prediction model.

[0014] Furthermore, it is determined whether the cloud server is awakened by the ventilator client. If so, the cloud server enters federated learning. Otherwise, the federated learning is skipped. S221. If the cloud server detects a wake-up request from the ventilator client, the cloud server communicates with the ventilator client to obtain the patient's airway flow velocity curve data, and uses a sliding window to extract features from the airway flow velocity curve data. A characteristic value of the airway flow velocity is obtained through integral calculation, and the patient is classified and grouped according to the tidal volume standard. S222. The ventilator client uploads the weights and biases of the tidal volume prediction model trained locally to the cloud server to ensure that the cloud server obtains the training results of the ventilator client and updates and aggregates the tidal volume prediction model. S223. The cloud server uses the federated averaging algorithm with differential population classification to weighted merge the weights of the tidal volume prediction models of different groups. The weights of the tidal volume prediction model of the current group are given the highest weight, while the weights of the tidal volume prediction models of non-current groups are given the lowest weight. S224. If the cloud server does not detect a wake-up request from the ventilator client, it skips federated learning.

[0015] Further, the formula of the federated averaging algorithm with differential population classification is: ; In the formula, r represents the number of training rounds; N is the global sample size; n s represents the local sample size of a certain client in the current group; n d represents the local sample size of a certain client outside the current group; S represents the current group; D represents non-current groups; N S represents the total sample size of the current group; N D represents the total sample size of non-current groups; w r+1 represents the next-round tidal volume prediction model; represents the weights of the tidal volume prediction model after device training within the current group; represents the weights of the tidal volume prediction model after training of non-current groups outside the group.

[0016] Further, based on the tidal volume prediction model, the physiological data collected in real time at the ventilator end is predicted to obtain the tidal volume of the patient; and adjusting the air pressure output of the ventilator based on the tidal volume includes: S31. Initialize the ventilator client and load the tidal volume prediction model; S32. The ventilator client collects the airway flow rate data of the patient in real time through sensors, extracts feature data using a sliding window, and normalizes the feature data; S33. Based on the processed feature data, the ventilator client uses the loaded tidal volume prediction model to predict the tidal volume and predicts the tidal volume of the patient at the next moment; S34. Convert the predicted tidal volume into a control signal of the ventilator client, control the motor state of the ventilator, and adjust the air pressure output of the ventilator; S35. Trigger the autonomous learning of the ventilator at fixed intervals, and determine whether the ventilator needs a more optimal tidal volume prediction model. If so, the ventilator sends a request to the cloud server via network connection to wake up the cloud server and start cloud federated learning to obtain the tidal volume prediction model in the cloud. S36. Use the processed feature data to test the accuracy of the tidal volume prediction model of the ventilator and the tidal volume prediction model in the cloud, and select the coefficient of determination as the evaluation index for the performance of the tidal volume prediction model of the ventilator and the tidal volume prediction model in the cloud. S37. Evaluate the magnitudes of the coefficients of determination of the tidal volume prediction model of the ventilator and the tidal volume prediction model in the cloud. If the coefficient of determination of the tidal volume prediction model in the cloud is greater than that of the tidal volume prediction model of the ventilator, update the tidal volume prediction model of the ventilator; otherwise, do not update. S38. According to the update result, the ventilator will reload the tidal volume prediction model as the current optimal tidal volume prediction model of the ventilator and continue to execute other tasks in the ventilator to ensure the stable operation of the device.

[0017] Further, the formula for the coefficient of determination is: ; In the formula, y i represents the true value of the sample; represents the predicted value of the tidal volume prediction model; represents the mean of the true values; represents the sum of squared residuals; represents the total sum of squares.

[0018] The beneficial effects of the present invention are as follows: 1. Through the collaborative work between the cloud and the ventilator side, the present invention uses the federated learning algorithm to optimize the neural network model, continuously improving the prediction accuracy and control performance of the ventilator while ensuring data privacy. In addition, the cloud uses the federated learning mechanism to aggregate data of similar patients within each group to optimize the model within the group, and at the same time combines low-weight information across groups to improve the generalization ability of the model. During the model optimization process, different patients using the ventilator are labeled according to their nocturnal physiological data (i.e., airway flow velocity data), and the models of each group are independently optimized. Through the federated average algorithm for differential population classification, the cloud can issue a model more suitable for the corresponding population according to the characteristics of different populations, ensuring that the model used in the ventilator can more accurately match the breathing events of different groups and improving the prediction accuracy and control effect.

[0019] 2. The present invention converts the traditional data-driven ventilator pressure output method into a prediction-driven ventilator pressure output method, and uses a neural network model and sensors to jointly complete the regulation of the ventilator output pressure. In the present invention, the ventilator will use the prediction result of the model as the main influencing factor for the motor speed, and actively regulate the motor speed according to the high or low prediction result. The data monitored by the sensors will serve the neural network and be used as a backup for model control to ensure the reliable operation of the ventilator.

[0020] 3. The present invention ensures that the ventilator always adopts the optimal model by monitoring the model performance in real time, updating the parameters regularly, and combining the comparative analysis of the cloud model and the local model, so as to provide precise respiratory support for patients. It not only improves the personalization and adaptability of the model, but also enables efficient model sharing and collaborative optimization among different devices, thereby enhancing the applicability of the model in diverse patient groups and having strong clinical application potential. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0022] Figure 1 is a flowchart of a prediction-driven household ventilator air pressure control method based on federated learning according to an embodiment of the present invention; Figure 2 is a schematic diagram of an LSTM neural network model according to an embodiment of the present invention; Figure 3 is a schematic diagram of the specific implementation steps of the cloud according to an embodiment of the present invention; Figure 4 is a schematic diagram of the specific implementation steps of the ventilator end according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0023] To further illustrate the embodiments, the present invention provides drawings, which are part of the disclosure of the present invention. They are mainly used to illustrate the embodiments and can be used to explain the operating principle of the embodiments in conjunction with the relevant descriptions in the specification. With reference to these contents, those of ordinary skill in the art should be able to understand other possible implementation manners and the advantages of the present invention.

[0024] According to an embodiment of the present invention, a prediction-driven household ventilator air pressure control method based on federated learning is provided.

[0025] Now, the present invention will be further described in conjunction with the drawings and specific implementation manners, as Figure 1As shown, the prediction-driven home ventilator air pressure control method based on federated learning according to an embodiment of the present invention includes: S1. Obtain the physiological data of the patient, construct a double-layer long short-term memory network model (i.e., a double-layer LSTM neural network model) based on the physiological data, and use the adaptive moment estimation optimizer (i.e., the Adam optimizer) to train the double-layer long short-term memory network model to obtain a tidal volume prediction model; S2. Upload the weights of the tidal volume prediction model to the cloud, and perform aggregation optimization on the tidal volume prediction models of several ventilator terminals through federated learning to obtain an optimized global tidal volume prediction model, and send the optimized tidal volume prediction model to each ventilator terminal for update; S3. Based on the tidal volume prediction model, predict the physiological data collected in real time at the ventilator terminal to obtain the tidal volume of the patient; and adjust the air pressure output of the ventilator based on the tidal volume.

[0026] In this alternative embodiment, obtaining the physiological data of the patient, constructing a double-layer long short-term memory network model based on the physiological data, and using the adaptive moment estimation optimizer to train the double-layer long short-term memory network model to obtain a tidal volume prediction model includes: S11. Obtain the physiological data of the patient, perform normalization processing on the physiological data, and map it to a preset interval; S12. Based on the processed physiological data, construct a first layer as a long short-term memory network layer, and use the rectified linear unit (i.e., ReLU) as the activation function, and set to return the complete time series; S13. Construct a second layer as a dropout layer, and preset a dropout rate to randomly mask the outputs of some neurons; S14. Construct a third layer as a long short-term memory network layer, and use the rectified linear unit as the activation function, and set to return the complete time series; S15. Construct a fourth layer as a dropout layer, and preset a dropout rate; S16. Construct a fifth layer as a global average pooling 1D layer, and perform global average pooling operation on the time series data output by the previous long short-term memory network layer through the global average pooling 1D layer, average all time steps on all feature dimensions, and generate a feature vector with a fixed length; S17. Construct a sixth layer as a fully connected layer, and process the feature vector output by the previous global average pooling 1D layer through the fully connected layer to generate a tidal volume prediction value of one neuron, and obtain a double-layer long short-term memory network model; S18. Use the adaptive moment estimation optimizer to train the double-layer long short-term memory network model, and perform end-to-end training in combination with the differential group loss function, and finally train to obtain a tidal volume prediction model.

[0027] In this alternative embodiment, an adaptive moment estimation optimizer is used to train the double-layer long short-term memory network model, and end-to-end training is carried out in combination with a differential group loss function. Finally, the tidal volume prediction model obtained through training includes: S181. Use the adaptive moment estimation optimizer to calculate the gradient of the double-layer long short-term memory network model respectively, update the first moment and the second moment, and perform bias correction and parameter update; S182. In each iteration, calculate the gradient vector based on the current parameters and the loss function, and provide the required gradient information for subsequent parameter updates; S183. Update the first moment, smooth the gradient by weighting the historical gradient direction and using an exponential decay rate to obtain an estimate of the current gradient direction; S184. Update the second moment, adjust the learning rate of the gradient by taking a weighted average of the squared gradient to adapt to different gradient changes; S185. Perform bias correction on the first moment and the second moment to eliminate the zero-value bias at the initial moment; S186. Use the corrected first moment and second moment to adjust the parameter update step size and update the parameters to ensure that the model parameters gradually approach the optimal value; S187. In combination with the differential group loss function, process data of different groups during the training of the double-layer long short-term memory network model, and calculate the weighted loss for the current group and the non-current group respectively; S188. Through the differential group loss function, process the prediction errors of the current group and the non-current group differently, and adjust the weighted coefficient of the loss function; S189. Complete the training and finally obtain the tidal volume prediction model.

[0028] It should be noted that, as Figure 2 shown, the first part of the present invention is the construction of the double-layer LSTM neural network model used in the ventilator. The details of the construction of the double-layer LSTM neural network model are as follows: 1) Construct the first layer as an LSTM layer. The LSTM long short-term memory network captures the long-term dependence relationship of the input sequence through a gating mechanism (that is, captures the correlation relationship of the input data in the time dimension). This layer uses 32 hidden units and selects ReLU as the activation function. The input data is mapped to the interval [0, 1] after being normalized. To enable the LSTM layer to preserve the complete time step information for subsequent layers to further process the time series features, this layer will return the complete time series. The ReLU activation function can effectively alleviate the problem of gradient disappearance in the LSTM layer and accelerate the training process of the model. The mathematical expression of the ReLU function is: ; In the formula, when the input x is greater than 0, the output is x; when the input is less than or equal to 0, the output is 0.

[0029] 2) Construct the second layer as a dropout layer. During the training process, the dropout layer randomly masks the outputs of some neurons. In the double long short-term memory network model, the dropout rate of this layer is set to 0.1 to reduce the over-dependence of the double long short-term memory network model on specific neurons and suppress the overfitting phenomenon (that is, a certain number of neurons are masked during training to prevent overfitting).

[0030] 3) Construct the third layer as an LSTM layer. The configuration of this layer is the same as that of the first layer (that is, capturing the correlation relationship of the input data in the time dimension), including 32 hidden units and using the ReLU activation function. By stacking multiple LSTM layers, the double long short-term memory network model can capture higher-level temporal features and long-term dependencies, enhancing the learning ability of the double long short-term memory network model for complex patterns. To enable the LSTM layer to preserve the complete time step information for subsequent layers to further process the temporal features, this layer returns the complete temporal sequence.

[0031] 4) Construct the fourth layer as a dropout layer. During training, a certain number of neurons are masked to prevent overfitting. The dropout rate of this layer in the model is set to 0.1.

[0032] 5) Construct the fifth layer as a global average pooling 1D layer (i.e., global average pooling in one dimension), which compresses the temporal dimension into the feature mean. This layer performs a global average pooling operation on the temporal data output by the previous LSTM layer, averaging all time steps in all feature dimensions to generate a fixed-length feature vector. The model with the global average pooling layer can effectively extract global features from the entire temporal sequence, rather than relying on the specific information of each time step, thereby reducing the data dimension and computational complexity.

[0033] 6) Construct the sixth layer as a fully connected layer to linearly transform the sequence to the target dimension. This layer contains 1 neuron for generating the predicted value of the patient's tidal volume at the next moment. This layer is a further processing of the result of the previous global average pooling 1D layer. In addition, to prevent the excessive growth of model parameters and improve the generalization ability, this layer introduces the L2 regularization rule (the weight decay coefficient is set to 0.01), that is, adding a penalty term of the square of the weight to the loss function to constrain the parameter scale and reduce the model complexity.

[0034] 7) The training process of the model uses the Adam optimizer, which alleviates the instability of long sequence training, suppresses abnormal gradients, and avoids random parameter offsets through five stages. The five stages of the Adam optimizer are described as follows: 7.1) The first stage is gradient calculation. In the z-th iteration, based on the previous step parameters θ z-1Given the loss function f(θ), calculate the gradient vector of the mini-batch data. The gradient calculation formula is: ; where z represents the iteration number; g z represents the gradient calculated in the z-th iteration; θ z-1 represents the parameter after the (z - 1)-th iteration; f(θ z-1 ) represents the value of the loss function under the parameter θ z-1 ; represents the operation of taking the gradient with respect to the parameter θ.

[0035] 7.2) The second stage is the update of the first moment (mean). The historical gradients are weighted and averaged by the exponential decay rate β1 to accumulate the gradient direction trend, accelerate convergence, and reduce oscillations. The first moment update formula is: ; where m z represents the first moment of the z-th iteration; m z-1 represents the first moment of the (z - 1)-th iteration; β1 represents the exponential decay rate of the first moment, with a value range of [0.8, 0.999], and a typical value of 0.9; g z represents the gradient calculated in the z-th iteration.

[0036] 7.3) The third stage is the update of the second moment (variance). The squared gradients are weighted and averaged by the exponential decay rate β2 to adaptively adjust the parameter learning rate. The second moment update formula is: ; where v z represents the second moment of the z-th iteration; v z-1 represents the second moment of the (z - 1)-th iteration; β2 represents the exponential decay rate of the second moment, with a value range of [0.9, 0.9999], and a typical value of 0.999; g z 2 represents the element-wise square of the gradient g z .

[0037] 7.4) The fourth stage is bias correction. To eliminate the update bias caused by the initial zero values of the first moment m z and the second moment v z , normalize the uncorrected moments: The formula for bias correction of the first moment is: ; The formula for bias correction of the second moment is: ; where z represents the iteration number; Represents the corrected first moment; Represents the corrected second moment; Represents the z-th power of the exponential decay rate of the first moment; Represents the z-th power of the exponential decay rate of the second moment; denominator and are used to compensate for the zero-value offset of the moment estimation at the initial moment.

[0038] 7.5) The fifth stage is parameter update. Based on the corrected first moment and the second moment , adjust the parameter update step size, and the formula is: ; In the formula, z represents the number of iterations; Represents the corrected first moment; Represents the corrected second moment; θ z Represents the updated parameter; α represents the learning rate; Represents taking the square root of each element of the corrected second moment; ε represents a very small positive number (e.g., 10 -8 ), which is used to avoid a zero denominator.

[0039] 8) To enable the neural network to better adapt to the current population characteristics, the present invention proposes a new loss function based on the fluctuation of tidal volume after feature extraction. According to the fluctuation of tidal volume, the dataset extracted from polysomnography is divided into two categories: one is the dataset similar to the current training population, called the S (Similar) class (i.e., the current population); the other is the dataset different from the current training population, called the D (different) class (i.e., the non-current population), and based on the different changes in tidal volume of the two populations, a differential population loss function (MAE W ) based on the tidal volume change trend is introduced, and its formula is as follows: ; In the formula, N represents the total number of samples; S represents the current population; D represents the non-current population; N S represents the total number of samples in the current population (i.e., label S, (Similar) class); N D represents the total number of samples in the non-current population (i.e., label D, (different) class); α represents the weight coefficient of the current population; β represents the weight coefficient of the non-current population; y s represents the true tidal volume value of the current population; y d represents the true tidal volume value of the non-current population; μ s represents the predicted tidal volume value of the current population; μ d represents the predicted tidal volume value of the non-current population; σ sRepresents the predicted variance of the current group; σ d Represents the predicted variance of non-current groups; γ represents the adversarial penalty coefficient; ε represents a very small positive number.

[0040] 9) During the training process of the model, the loss function uses a custom differential group loss function (MAE W ). The formula of the differential group loss function realizes the refined fitting of the current group (label S) and the appropriate suppression of the non-current group (label D) by dynamically adjusting the loss weights of different groups. First, according to the number of samples N S and N D of the current group and the non-current group, calculate their uncertainty weighted losses of the prediction errors respectively: ; where ε is a very small positive number, and ε can be set to 10 -6 . Secondly, adjust the contribution ratio of the two types of groups through the weight coefficients α and β (usually set α much larger than β to strengthen the fitting of the current group). Thirdly, the formula introduces an adversarial penalty term: ; where γ is used to explicitly increase the penalty for the prediction error of the data with label D, forcing the model to appropriately deviate from the feature patterns of the non-current group, and explicitly increasing the penalty for the prediction error of the non-current group. It can be set to γ = 0.1 to appropriately suppress the adaptation to the label D. Through the design of the differential group loss function, the model can ensure that while capturing the commonalities of all patient feature quantities (such as the tidal volume mentioned in the present invention), it can also accurately capture the differences in the physiological characteristics of the current group. Through the differential group loss function, the model results are biased towards the same group and appropriately deviate from the non-current group, thereby significantly improving the prediction performance.

[0041] In this alternative embodiment, uploading the weights of the tidal volume prediction model to the cloud and aggregating and optimizing the tidal volume prediction models of several ventilator terminals through federated learning to obtain an optimized global tidal volume prediction model, and downloading the optimized tidal volume prediction model to each ventilator terminal for update includes: S21. Initialize the cloud server, check whether there is already a tidal volume prediction model. If so, directly transmit it to the ventilator client; otherwise, enter the subsequent training stage; S22. Determine whether the cloud server is awakened by the ventilator client. If so, the cloud server enters federated learning; otherwise, skip federated learning; S23. The cloud server extracts airway flow rate feature data from the polysomnography data and normalizes the airway flow rate feature data; S24. Arrange the tidal volume data in chronological order and divide the tidal volume data into a training set and a test set; S25. Combine the current group and non-current group of different populations, and use the federated averaging algorithm for differential population classification to train the tidal volume prediction model; S26. Use the trained tidal volume prediction model to predict the airway flow rate characteristic data of the patient, obtain the tidal volume prediction value, and calculate the coefficient of determination between the prediction value and the true value to evaluate the performance of the tidal volume prediction model; S27. Upload the weights of the tidal volume prediction models at each ventilator end to the cloud, and aggregate and optimize the tidal volume prediction models at each ventilator end through federated learning to generate a globally optimized tidal volume prediction model.

[0042] It should be noted that, as Figure 3 shown, the second part of the present invention is the implementation steps of the cloud: Step 1. Cloud wake-up: The cloud wake-up process includes loading the cloud server and completing the server initialization. During the initialization process, the server will check according to the upcoming tasks. If a trained model already exists in the cloud server and the server receives a request to transfer the existing model, the model will be transferred to the ventilator client. For simple tasks, there is no need to enter the subsequent training loop, and the server will directly provide the corresponding service.

[0043] Step 2. Whether to perform federated learning: By judging whether the server is awakened by the ventilator client, or the server contains a trained model and two or more connectable clients, the server enters the federated learning step; if the above conditions are not met, the federated learning step is skipped.

[0044] Federated learning Step 1. Communication between the cloud and multiple ventilators: The cloud communicates with the ventilator client, obtains information such as the model version and model structure in the ventilator, and compares it with the existing cloud model. When the cloud communicates with the ventilator, it will obtain the airway flow rate curve of the patient within a period of time t at night, and use a sliding window with a window length of 3s and a step size of 1s to intercept the airway flow rate curve, and perform feature extraction on the airway flow rate curve within each sliding window, that is, integrate the airway flow rate curve. The integral formula for feature extraction is: ; In the formula, t represents time; t s represents the start time of the window; t eIndicates the window end time; f(t) represents the nasal airflow velocity curve (i.e., the airway flow velocity curve); dt is the integral of the time element t along the time axis t.

[0045] The tidal volume of a normal person's single breath is about 500 ml, and the single breath time is about 3 - 5 s. Therefore, the feature extraction result should be around 400 - 500 mL. Thus, the present invention will calculate the average value of the feature extraction results as the standard for classifying different types of patients. The average value formula is: ; In the formula, result represents the average value result; n represents the number of feature extraction results, that is, there are n ts f1 ; t f are the results of feature extraction for different sliding windows.

[0046] The present invention will use a tidal volume interval of 100 mL to classify different patients. The classification labels are: the population with a window tidal volume of 200 - 300 mL, the population with a window tidal volume of 300 - 400 mL, the population with a window tidal volume of 400 - 500 mL, etc. Finally, the distribution result of the patients should tend to a normal distribution, mainly concentrated in the population with a window tidal volume of 300 - 400 mL and the population with a window tidal volume of 400 - 500 mL. The specific application of the population classification method of the present invention is as follows: When the cloud communicates with the ventilator of Patient A, the cloud learns that the ventilator contains the airway flow velocity curve of the patient during 30 minutes of sleep. After segmentation by a sliding window with a window length of 3 s and a step size of 1 s, and feature extraction for each window, The results of feature extraction for 1798 different sliding windows will be obtained. The data will be brought into the average value formula for calculation to obtain the result of result. Assuming the result is within 300 - 400 mL, the patient will obtain the label of "the population with a window tidal volume of 300 - 400 mL", and the classified data set will be labeled accordingly for use in subsequent training. During the model optimization process, the cloud identifies the labels in different patients' ventilators, matches the group data with the same or similar labels, and counts the number of models in the current group and the non - current group. The weight of the current group in the federated average algorithm for differential population classification is increased, and the weight of the non - current group in the federated average algorithm for differential population classification is reduced, thereby enhancing the adaptability of the neural network to the current group. Compared with all clients using a single general model, the federated learning method introducing the federated average algorithm for differential population classification can improve the accuracy of the treatment plan in different groups, enabling patients in different groups to obtain highly accurate personalized treatment.

[0047] Federated Learning Step Two: Obtain the weights and biases of the double - layer LSTM neural network model in the ventilator: Through communication with the cloud server, the ventilator uploads the model weights and biases in the ventilator to the cloud. This process ensures that the training results of the local model can be obtained by the cloud, and similar weight parameters are extracted and aggregated.

[0048] Step 3 of federated learning, Cloud federated learning for different populations: Different clients of the ventilator will upload the weights and biases of the model, and the cloud will receive the corresponding weights and biases and aggregate them using the federated averaging algorithm for different populations. For example, in the face of groups with the same classification (such as those belonging to the population with a window tidal volume of 300 - 400 mL), the weights of the models they upload are given a higher weight, such as 70%, in the calculation of the federated averaging algorithm for different populations; for groups that are not the current population, the weights of their models are given a lower weight, such as 30%, in the calculation of the federated averaging algorithm for different populations. This federated averaging algorithm based on different population classifications can be dynamically adjusted according to actual needs, so as to achieve an effective balance between the generalization ability of the model and individual optimization. The formula for the federated averaging algorithm for different population classifications is: ; In the formula, r represents the number of training rounds; N is the global sample size; n s represents the local sample size of a certain client in the current population; n d represents the local sample size of a certain client outside the current population; S represents the current population; D represents the non-current population; N S represents the total sample size of the current population; N D represents the total sample size of the non-current population; w r+1 represents the next tidal volume prediction model; represents the weight of the tidal volume prediction model after device training within the current population; represents the weight of the tidal volume prediction model after training for the non-current population outside the group.

[0049] The specific calculation process of the federated averaging algorithm for different population classifications in the present invention is as follows: The cloud obtains the model weights from different ventilator clients. For example, the cloud selects the group that needs to be trained and marks it as S representing the current population. The current population includes client A (data volume 1000) and client B (data volume 500). The clients of the non-current population are marked as D, and the non-current population includes client C (data volume 500) and client D (data volume 800). The algorithm first calculates the weighted average values of the model parameters for the specific population and other populations respectively. The weighted average value for the specific population is: ; The weighted average value for other populations is: ; Subsequently, the two are fused according to a preset ratio (such as 70% and 30%) to obtain updated global model parameters: ; Finally, finally use w t+1 Replace the weights in the model to generate a new model.

[0050] This strategy enables the model to absorb individual information while preferentially optimizing the feature distribution of specific groups, and at the same time utilize the data of other groups to improve the generalization ability. The updated global model is sent to each device for the next round of training and inference. Thanks to the use of federated learning, the model update between the ventilator and the cloud will involve little or no patient privacy information, that is, while ensuring data privacy, continuously optimize the model performance and enhance the adaptability of the model to the target group.

[0051] Step 3: Data feature extraction, population classification, and feature normalization: The cloud will select appropriate data channels from the polysomnography results and perform feature extraction on the channel data. Polysomnography is the gold standard for diagnosing sleep disorders in the current field of sleep medicine. Polysomnography can provide comprehensive and objective physiological signal records. By synchronously recording multiple physiological parameters, it evaluates an individual's sleep structure, respiratory status, and neuromuscular activity, and is widely used in the clinical diagnosis and research of sleep diseases such as obstructive sleep apnea.

[0052] There are a wide variety of parameters recorded in polysomnography, including electroencephalogram (EEG), electrooculogram (EOG), and airway flow rate, etc. These parameters are all of great significance in evaluating sleep structure and diagnosing sleep disorders. In the present invention, taking airway flow rate as an example, the population will be classified, and the polysomnography results will be subjected to feature extraction and normalization processing.

[0053] The nasal flow rate data in polysomnography is collected using a nasal flow rate sensor. The nasal flow rate sensor determines the patient's inspiratory and expiratory flow rates by monitoring the pressure changes in the nasal cavity. The sampling frequency of the sensor in the dataset is 100Hz / s, and the physical measurement limit is [-100, 100]. In the present invention, population classification will be randomly based on the airway flow rate data in a polysomnography result with a length of 10 min - 30 min. After the airway flow rate curve is intercepted using a sliding window with a window length of 3 s and a step size of 1 s, the absolute value of the airway flow rate data is taken, and then feature extraction is performed on the airway flow rate curve within each sliding window, that is, integrating the airway flow rate curve for this section.

[0054] Feature normalization is used to adjust the numerical ranges of different features so that they have similar scales, avoiding the impact of dimensional differences between features on model training, thereby improving the stability of gradient descent and optimization efficiency. For neural networks, feature normalization can accelerate convergence, reduce the risk of gradient explosion or vanishing, and enhance the generalization ability of the model. Since the dataset of the present invention has a uniform distribution, maximum-minimum normalization is adopted to map the data into the range of [0, 1]. The maximum-minimum normalization formula is: ; where: x * represents the value after maximum-minimum normalization; x max represents the maximum value of the data in the sample; x min represents the minimum value of the sample data.

[0055] In the dataset collected through the previous feature extraction step, the maximum tidal volume value is defined as x max ; the minimum tidal volume value is defined as x min . Subsequently, traverse the dataset, substitute the current tidal volume into the position of x in the formula, and perform normalization calculation on the data according to x max and x min to obtain the result x * , which is the normalized result.

[0056] Step Four: Division of Training Set and Test Set: Arrange the tidal volume data in chronological order and through multiple experiments, it is finally determined that 17 consecutive tidal volumes are used as input data to predict the tidal volume of the patient at the next moment. After sorting, the dataset finally contains 47,622 pieces of data, of which 42,896 pieces of data are used for model training and 4,726 pieces of data are used to test the model.

[0057] Step Five: Cloud Model Training: Given that the change of tidal volume data is significantly correlated with respiratory events, and the input tidal volume data has high temporal characteristics, the cloud model adopts a two-layer LSTM neural network model, which can effectively capture the temporal characteristics and their complex dependencies in the tidal volume data sequence. The system in the present invention will create a model after the first online operation in the cloud, and the model structure is as described in the composition of the LSTM neural network model in the first part. The system will save and continuously use the current model structure during subsequent operations. The cloud will combine different population labels in the dataset and use the federated average algorithm for differential population classification to train the cloud model.

[0058] Step Six: Evaluate Model Performance Using the Coefficient of Determination: Coefficient of determination r 2It reflects the fitting degree of the model to the real data, with a value range of [0, 1]. The closer the value is to 1, the stronger the model's ability to interpret the data and the better the fitting effect. Taking the double-layer LSTM neural network model as an example, this invention extracts features from the patient airway flow rate data collected in the ventilator, uses 17 known sliding windows with a window length of 3s and a step size of 1s for feature extraction, and predicts the size of the patient's next tidal volume. This task is a typical regression task (i.e., prediction type), so r 2 is reasonable as an evaluation index for the model performance. The mathematical expression of the coefficient of determination is: ; In the formula, y i represents the true value of the sample; represents the predicted value of the tidal volume prediction model; represents the mean of the true values; represents the sum of squared residuals; represents the total sum of squares.

[0059] Step Seven: Store and distribute the cloud model to the corresponding population: After completing the model aggregation and update, the cloud server will save the currently updated global model, including the weights and biases of the model. This model will be securely stored in the cloud for subsequent access and use. At the same time, the cloud server will determine the target population for this round of training and distribute the trained model to the clients of this population to ensure that the ventilators of the same population can obtain the latest version of the model.

[0060] In this alternative embodiment, determining whether the cloud server is awakened by the ventilator client. If so, the cloud server enters federated learning; otherwise, skipping federated learning includes: S221. When the cloud server detects a wake-up request from the ventilator client, the cloud server communicates with the ventilator client, obtains the airway flow rate curve data of the patient, extracts features from the airway flow rate curve data using a sliding window, calculates the feature value of the airway flow rate through integration, and classifies the patient and groups them according to the tidal volume standard; S222. The ventilator client uploads the weights and biases of its locally trained tidal volume prediction model to the cloud server to ensure that the cloud server obtains the training results of the ventilator client and updates and aggregates the tidal volume prediction model; S223. The cloud server uses the federated average algorithm for differential population classification to weighted merge the weights of the tidal volume prediction models of different groups. The weights of the tidal volume prediction model of the current group are given the highest weight, while the weights of the tidal volume prediction models of non-current groups are given the lowest weight; S224. If the cloud server does not detect a wake-up request from the ventilator client, then skip federated learning.

[0061] In this alternative embodiment, based on the tidal volume prediction model, physiological data collected in real time at the ventilator end is predicted to obtain the patient's tidal volume; and adjusting the air pressure output of the ventilator based on the tidal volume includes: S31. Initialize the ventilator client and load the tidal volume prediction model; S32. The ventilator client collects the patient's airway flow velocity data in real time through sensors, extracts feature data using a sliding window, and normalizes the feature data; S33. Based on the processed feature data, the ventilator client uses the loaded tidal volume prediction model to predict the tidal volume and predicts the patient's tidal volume at the next moment; S34. Convert the predicted tidal volume into a control signal of the ventilator client, control the motor state of the ventilator, and adjust the air pressure output of the ventilator; S35. Trigger the ventilator's autonomous learning at fixed intervals and determine whether the ventilator needs a better tidal volume prediction model. If so, the ventilator sends a request to the cloud server through the network connection to wake up the cloud server and start cloud federated learning to obtain the cloud's tidal volume prediction model; S36. Use the processed feature data to test the accuracy of the ventilator's tidal volume prediction model and the cloud's tidal volume prediction model, and select the coefficient of determination as the evaluation index for the performance of the ventilator's tidal volume prediction model and the cloud's tidal volume prediction model; S37. Evaluate the magnitudes of the coefficients of determination of the ventilator's tidal volume prediction model and the cloud's tidal volume prediction model. If the coefficient of determination of the cloud's tidal volume prediction model is greater than that of the ventilator's tidal volume prediction model, then update the ventilator's tidal volume prediction model; otherwise, do not update; S38. According to the update result, the ventilator will reload the tidal volume prediction model as the current optimal tidal volume prediction model of the ventilator and continue to execute other tasks in the ventilator to ensure the stable operation of the device.

[0062] It should be noted that, as Figure 4 shown, the third part of the present invention is the specific implementation steps at the ventilator end: Step 1. Initialization of the ventilator client: The ventilator client will perform self-checks during the initialization phase, check the operating status of each system of the ventilator, and ensure the normal operation of the hardware and software. Subsequently, the ventilator loads and initializes its own neural network model to prepare for subsequent prediction or data processing tasks.

[0063] Step 2: The ventilator operates and monitors the patient's physiological parameters, and extracts features from the physiological parameters: Before going to bed, the patient wears the ventilator properly and starts the ventilator for treatment. The patient's physiological parameters refer to the patient's physiological parameters that can be monitored in the ventilator, such as the airway flow rate, tidal volume, and airway pressure during the patient's sleep. Since the cloud uses the airway flow rate data in the polysomnography data, which corresponds to the airway flow rate data that can be monitored in the ventilator, the present invention will select the airway flow rate data in the ventilator as the representative of the patient's physiological parameters. During the operation of the ventilator, the neural network prediction results and the monitoring sensor parameters are used together to judge the patient's current state, and to determine the pressure change time point and the pressure change magnitude. In this set of control logic of the sensor and the neural network, the prediction-driven neural network model is the main control logic. The motor state is determined by the model output results, and the sensor is responsible for parameter monitoring and backup control. At the same time, the sensor records the airway flow rate curve data of the patient every 60 minutes for 10 to 30 minutes. The airway flow rate curve is intercepted using a sliding window with a window length of 3 s and a step size of 1 s. Secondly, the absolute value of the data is taken. Finally, features are extracted from the data in each sliding window, that is, the integral of this section of the airway flow rate curve is performed.

[0064] Step 3: Normalize the patient's physiological parameters in the ventilator: The results after feature extraction are combined in chronological order to form an input data containing 17 tidal volume values. This data is used as the input of the neural network, and the input shape is the same as that of the cloud model input. These physiological data can effectively reflect the patient's breathing characteristics. After the physiological data is completed with feature extraction and normalization, it will be transmitted to the model for model training.

[0065] After the patient's airway flow rate curve is subjected to feature extraction, maximum-minimum normalization will be used. The maximum value at the ventilator end is the maximum value extracted during the patient's sleep, and the minimum value is the minimum value extracted during the patient's sleep. The data will be mapped to the range of [0, 1].

[0066] Step 4: The model predicts the patient's physiological data at the next moment.

[0067] Step 5: Convert the model prediction result into a ventilator control signal to control the state of the ventilator motor: The present invention uses the results of feature extraction and normalization of the patient's nocturnal airway flow rate as the input of the model, and outputs the magnitude of the tidal volume at the next moment of the patient. This result will be inversely solved for the normalization formula to obtain the true value of the model's prediction of the patient's airway flow rate at the next moment. The inverse solution of the normalization formula is: ; In the formula: x is the true value of the model's prediction of the patient's future 3 s tidal volume; x *is the normalized result of the predicted tidal volume of the patient in the next 3s; x max is the maximum value of the feature extraction during the patient's sleep; x min is the minimum value of the feature extraction during the patient's sleep.

[0068] Substitute the predicted tidal volume value of the model into the reverse solution normalization formula to calculate the true value of the predicted tidal volume of the patient in the next 3s. The present invention uses a neural network model and a sensor to jointly complete the regulation of the output pressure of the ventilator. The ventilator will take the output result of the model as the main influencing parameter, and this parameter will actively regulate the rotation speed of the motor. The data monitored by the sensor will serve the neural network and be used as a backup for model control to ensure the reliable operation of the ventilator.

[0069] According to the classification and definition of respiratory events in the Primary Care Diagnosis and Treatment Guidelines for Adult Obstructive Sleep Apnea (2018), hypopnea means that the airflow through the nose and mouth during sleep is reduced by ≥30% compared to the baseline level, and apnea refers to the disappearance or significant weakening of the airflow through the nose and mouth during sleep (a decrease in amplitude by ≥90% compared to the baseline). According to the description in the primary care guidelines, the respiratory event segments marked in the polysomnography, and the real data measured in the ventilator, it is decided to define the recognition threshold as: the tidal volume is less than 150 mL after feature extraction from the 3s sliding window of airway flow velocity. If the tidal volume result of the next moment window output by the model is lower than 150 mL, it is judged that the patient is about to enter a respiratory event, and the ventilator pre-boosts the pressure (the pre-boost output pressure should be lower than the normal boost); if the tidal volume result of the next window is still lower than 150 mL, it is judged that the patient enters a respiratory event, and the ventilator boosts the pressure to the normal boost primary pressure level. If the tidal volume result of the next window predicted by the model is higher than 150 mL, and the ventilator is currently in a high ventilation pressure output state, it is judged that the patient is about to return to the normal spontaneous breathing state, and the ventilator pre-reduces the pressure (the output pressure during pre-pressure reduction should be higher than the normal pressure reduction to avoid discomfort caused by too fast pressure reduction). If the tidal volume result of the next window is still higher than 150 mL, it is judged that the patient has returned to the normal breathing state, and the ventilator reduces the pressure to the normal pressure reduction primary pressure level.

[0070] Step Six: Trigger the ventilator's autonomous learning at fixed intervals: The ventilator assembles the data processed in Step Three at the ventilator end into a training set, which is used for the small-batch and small-scale autonomous training of the local model, and incrementally updates the local model (i.e., the tidal volume prediction model of the ventilator). The present invention triggers a training every 2 hours, ensuring that the model can achieve real-time update without occupying too much computing resources, thus balancing the requirements of resource utilization and model optimization. The small-batch training method not only reduces the computing burden but also enables the model to better adapt to the physiological data distribution of the current group, improving its prediction accuracy and stability.

[0071] Step 7: Determine whether the ventilator expects a better model: The ventilator evaluates whether the currently used model can meet the performance requirements. If the prediction accuracy of the currently used model for the data collected in Step 3 does not reach the expectation (i.e., the coefficient of determination r of the predicted result of the tidal volume of the patient by this model 2 ≤ 80), the ventilator will request the cloud to update the model. This process can be judged by means of model performance monitoring, error analysis, etc., to ensure that the ventilator always uses the optimized model for prediction and motor control. If the judgment result is that the model needs to be updated, wake up the cloud and add it to the federated learning list to enter Step 8 Wake up the cloud and join the federated learning; if the current model is already the optimal model, continue to execute the original tasks of the ventilator, return to Step 2 The ventilator runs and monitors the patient's physiological parameters, and extracts features from the physiological parameters.

[0072] Step 8: Wake up the cloud and join the federated learning: If it is determined in the previous judgment that the ventilator expects a better model, the ventilator sends a request to the cloud through the network connection, wakes up the cloud server and starts the cloud federated learning process. The ventilator uploads the weights and biases of the locally trained model to the cloud, and the cloud will perform aggregation and update.

[0073] Step 9: Obtain the cloud model (i.e., the tidal volume prediction model on the cloud).

[0074] Step 10: Determine whether the cloud model is better than the local model: The ventilator uses the dataset obtained in Step 3 to test the accuracy of the local model and the cloud model of the ventilator. Select the coefficient of determination r 2 as the evaluation index of the model performance, which is consistent with the above text of the present invention (i.e., the mathematical expression of the coefficient of determination).

[0075] Step 11: Update or not update the local model: By comparing the performance of the two models on the same dataset, evaluate the coefficient of determination r of the cloud model and the local model in predicting the same set of local data 2 value. If the cloud model is better than the local model (i.e., the r value of the cloud model 2 is high), update the local model; if the performance of the cloud model is not ideal (i.e., the r value of the cloud model 2 is low), do not update the local model.

[0076] Step 12: Reload the model: Based on the previous judgment, the ventilator will choose to reload the model. Regardless of which model is selected, the loading process ensures that the ventilator has the current optimal model, providing more accurate prediction and control functions. After the model is loaded, the system will return to and continue executing other tasks in the ventilator, ensuring stable operation of the device.

[0077] In summary, the above-mentioned technical solutions of the present invention overcome the limitations of the single pressure control strategy of traditional home ventilators by constructing a dynamic pressure regulation system based on deep learning. This system, with a neural network model as its core driving engine, predicts the patient's airway flow rate data, determines the optimal pressure increase time, and generates motor control instructions. Compared to rule-based control algorithms, this design synchronizes pressure regulation with the patient's breathing time, effectively improving the lag in positive pressure ventilation therapy. The sensor system plays a dual role, providing real-time training data for the model and taking control when anomalies are detected, forming a dual security mechanism of "AI master control + physical sensing." Based on the differences in patient physiological characteristics, a group adaptive model library is established. Each sub-model shares the basic network structure but independently optimizes parameters, achieving a leap from "one policy for thousands of patients" to "classified precise control." This invention addresses the balancing issue of medical data privacy and model performance through a federated learning architecture. The local device only uploads model weight and bias updates to the cloud, while the patient's raw respiratory data remains internal to the ventilator. The cloud utilizes a clustering optimization strategy to fuse model parameters for patient groups with similar physiological characteristics (e.g., those with similar tidal volume fluctuations), strengthening group characteristics while also incorporating generalized features with a cross-group learning weight of 0.3. Each device regularly receives the latest optimized model for its group, preserving the ability to continuously optimize for individual subtle characteristics while also synergizing the group's medical knowledge base. This invention classifies patients based on differences in tidal volume across different patient windows to identify specific groups with similar ventilation needs. Based on this, a deep learning model with differentiated weights is constructed for each group to precisely adapt the ventilation characteristics of each patient. This model can predict changes in a patient's physiological signals at the next moment and adjust the ventilator's air pressure output based on the changing trends of the patient's physiological characteristics during the night, thus achieving personalized ventilation therapy. Furthermore, by introducing a federated learning mechanism, multiple ventilator devices can collaborate with the cloud to optimize model parameters while ensuring data privacy and security. This continuously improves prediction accuracy and model generalization, more accurately meeting the individualized ventilation needs of different groups.

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

Claims

1. A prediction-driven air pressure control method for home ventilators based on federated learning, characterized in that Including: S1. Obtain the physiological data of the patient, construct a double-layer long short-term memory network model based on the physiological data, and use the adaptive moment estimation optimizer to train the double-layer long short-term memory network model to obtain a tidal volume prediction model; S2. Upload the weights of the tidal volume prediction model to the cloud, and aggregate and optimize the tidal volume prediction models of several ventilator terminals through federated learning to obtain an optimized global tidal volume prediction model, and send the optimized tidal volume prediction model to each ventilator terminal for update; S3. Based on the tidal volume prediction model, predict the physiological data collected in real time at the ventilator terminal to obtain the tidal volume of the patient; and adjust the air pressure output of the ventilator based on the tidal volume.

2. The predictive drive-based air pressure control method for a household ventilator based on federated learning according to claim 1, wherein The obtaining the physiological data of the patient, constructing a double-layer long short-term memory network model based on the physiological data, and using the adaptive moment estimation optimizer to train the double-layer long short-term memory network model to obtain a tidal volume prediction model includes: S11. Obtain the physiological data of the patient, normalize the physiological data, and map it to a preset interval; S12. Based on the processed physiological data, construct a first layer as a long short-term memory network layer, and use the rectified linear unit as the activation function, and set to return the complete time series; S13. Construct a second layer as a dropout layer, and preset a dropout rate, and randomly mask the outputs of some neurons; S14. Construct a third layer as a long short-term memory network layer, and use the rectified linear unit as the activation function, and set to return the complete time series; S15. Construct a fourth layer as a dropout layer, and preset a dropout rate; S16. Construct a fifth layer as a global average pooling 1D layer, and perform global average pooling operation on the time series data output by the previous long short-term memory network layer through the global average pooling 1D layer, average all time steps on all feature dimensions, and generate a fixed-length feature vector; S17. Construct a sixth layer as a fully connected layer, and process the feature vector output by the previous global average pooling 1D layer through the fully connected layer to generate a tidal volume prediction value of one neuron, and obtain a double-layer long short-term memory network model; S18. Use the adaptive moment estimation optimizer to train the double-layer long short-term memory network model, and perform end-to-end training in combination with the differential group loss function, and finally train to obtain a tidal volume prediction model.

3. The pressure control method of a prediction-driven household ventilator based on federated learning according to claim 2, characterized in that, The using the adaptive moment estimation optimizer to train the double-layer long short-term memory network model, performing end-to-end training in combination with the differential group loss function, and finally training to obtain a tidal volume prediction model includes: S!81. Use the adaptive moment estimation optimizer to calculate the gradient, update the first moment and the second moment, and perform bias correction and parameter update on the double-layer long short-term memory network model respectively; S182. In each iteration, calculate the gradient vector based on the current parameters and the loss function, and provide the required gradient information for subsequent parameter updates; S183. Update the first moment, smooth the gradient by weighting the historical gradient direction and using the exponential decay rate to obtain an estimate of the current gradient direction; S184. Update the second moment, adjust the learning rate of the gradient by weighted averaging the squared gradient to adapt to the changes of different gradients; S185. Perform bias correction on the first moment and the second moment to eliminate the zero-value bias at the initial moment; S186. Use the corrected first moment and second moment to adjust the parameter update step size and update the parameters to ensure that the model parameters gradually approach the optimal value; S187. Combine the differential group loss function to process data of different groups during the training of the double-layer long short-term memory network model, and calculate the weighted loss for the current group and the non-current group respectively; S188. Through the differential group loss function, process the prediction errors of the current group and the non-current group differently, and adjust the weighted coefficient of the loss function; S189. Complete the training and finally obtain the tidal volume prediction model.

4. A prediction-driven air pressure control method for a home ventilator based on federated learning according to claim 3, characterized in that The formula for calculating the gradient of the double-layer long short-term memory network model is: ; The formula for updating the first moment is: ; The formula for updating the second moment is: ; The formulas for performing bias correction on the first moment and the second moment are respectively: ; ; The formula for using the corrected first moment and second moment to adjust the parameter update step size is: ; where \(z\) represents the number of iterations; \(g\) z represents the gradient calculated in the \(z\)-th iteration; \(\theta\) z-1 represents the parameter after the \((z - 1)\)-th iteration; \(f(\theta\) z-1 ) represents the value of the loss function under the parameter \(\theta\) z-1 ; represents the operation of taking the gradient with respect to the parameter \(\theta\); \(m\) z represents the first moment in the \(z\)-th iteration; \(m\) z-1 represents the first moment in the \((z - 1)\)-th iteration; \(\beta_1\) represents the exponential decay rate of the first moment; \(v\) z represents the second moment in the \(z\)-th iteration; \(v\) z-1 represents the second moment in the \((z - 1)\)-th iteration; \(\beta_2\) represents the exponential decay rate of the second moment; \(g\) z 2 represents the element-wise square of the gradient \(g\) z ; represents the corrected first moment; represents the corrected second moment; represents the \(z\)-th power of the exponential decay rate of the first moment; represents the \(z\)-th power of the exponential decay rate of the second moment; θ z represents the updated parameter; α represents the learning rate; represents taking the square root element-wise of the corrected second moment; ε represents a very small positive number.

5. The pressure control method of a prediction-driven household ventilator based on federated learning according to claim 3, wherein, The formula for the differential group loss function is: ; Wherein, N represents the total number of samples; S represents the current group; D represents the non-current group; N S represents the total number of samples of the current group; N D represents the total number of samples of the non-current group; α represents the weight coefficient of the current group; β represents the weight coefficient of the non-current group; y s represents the true tidal volume value of the current group; y d represents the true tidal volume value of the non-current group; μ s represents the predicted tidal volume value of the current group; μ d represents the predicted tidal volume value of the non-current group; σs represents the predicted variance of the current group; σ d represents the predicted variance of the non-current group; γ represents the adversarial penalty coefficient; ε represents a very small positive number.

6. A predictive-driven air pressure control method for a household ventilator based on federated learning according to claim 1, characterized in that Uploading the weights of the tidal volume prediction model to the cloud, and aggregating and optimizing the tidal volume prediction models of several ventilator terminals through federated learning to obtain the optimized global tidal volume prediction model, and downloading the optimized tidal volume prediction model to each ventilator terminal for update includes: S21. Initialize the cloud server, check whether there is already a tidal volume prediction model. If so, directly transmit it to the ventilator client; otherwise, enter the subsequent training stage; S22. Determine whether the cloud server is awakened by the ventilator client. If so, the cloud server enters federated learning; otherwise, skip federated learning; S23. The cloud server extracts airway flow rate feature data from the polysomnography data and normalizes the airway flow rate feature data; S24. Arrange the tidal volume data in chronological order and divide the tidal volume data into a training set and a test set; S25. Combine the current group and the non-current group of different populations, and use the federated average algorithm for differential population classification to train the tidal volume prediction model; S26. Use the trained tidal volume prediction model to predict the airway flow rate feature data of the patient to obtain the tidal volume prediction value, and calculate the determination coefficient between the prediction value and the true value to evaluate the performance of the tidal volume prediction model; S27. Upload the weights of the tidal volume prediction models of each ventilator terminal to the cloud, and aggregate and optimize the tidal volume prediction models of each ventilator terminal through federated learning to generate a globally optimized tidal volume prediction model.

7. A prediction-driven air pressure control method for a household ventilator based on federated learning according to claim 6, wherein, The determination of whether the cloud server is awakened by the ventilator client. If so, the cloud server enters federated learning; otherwise, skip federated learning includes: S221. When the cloud server detects a wake-up request from the ventilator client, the cloud server communicates with the ventilator client, obtains the airway flow rate curve data of the patient, uses a sliding window to extract features from the airway flow rate curve data, calculates the eigenvalue of the airway flow rate through integration, classifies the patient, and clusters according to the tidal volume standard; S222. The ventilator client uploads the weights and biases of the locally trained tidal volume prediction model to the cloud server to ensure that the cloud server obtains the training results of the ventilator client and updates and aggregates the tidal volume prediction model; S223. The cloud server uses the federated averaging algorithm for differential population classification to weightedly merge the weights of the tidal volume prediction models of different groups. The weight of the tidal volume prediction model of the current group is given the highest weight, while the weight of the tidal volume prediction model of the non-current group is given the lowest weight; S224. When the cloud server does not detect a wake-up request from the ventilator client, federated learning is skipped.

8. A prediction-driven air pressure control method for a household ventilator based on federated learning according to claim 7, characterized in that, The formula of the federated averaging algorithm for differential population classification is: ; Where r represents the number of training rounds; N is the number of global samples; n s represents the number of local samples of a certain client in the current group; n d represents the number of local samples of a certain client outside the current group; S represents the current group; D represents the non-current group; N S represents the total number of samples in the current group; N D represents the total number of samples in the non-current group; w r+1 represents the next tidal volume prediction model; represents the weight of the tidal volume prediction model after device training within the current group; represents the weight of the tidal volume prediction model after training of the non-current group outside the group.

9. A pressure control method for a prediction-driven household ventilator based on federated learning according to claim 1, wherein, Based on the tidal volume prediction model, the physiological data collected in real time at the ventilator end is predicted to obtain the tidal volume of the patient; And adjusting the air pressure output of the ventilator based on the tidal volume includes: S31. Initialize the ventilator client and load the tidal volume prediction model; S32. The ventilator client collects the airway flow rate data of the patient in real time through sensors, uses a sliding window to extract feature data, and normalizes the feature data; S33. Based on the processed feature data, the ventilator client uses the loaded tidal volume prediction model to predict the tidal volume and predicts the tidal volume of the patient at the next moment; S34. Convert the predicted tidal volume into a control signal of the ventilator client, control the motor state of the ventilator, and adjust the air pressure output of the ventilator; S35. Trigger the ventilator's autonomous learning at fixed intervals and determine whether the ventilator needs a better tidal volume prediction model. If so, the ventilator sends a request to the cloud server through the network connection to wake up the cloud server and start cloud federated learning to obtain the cloud tidal volume prediction model; S36. Use the processed feature data to test the accuracy of the tidal volume prediction model of the ventilator and the cloud tidal volume prediction model, and select the coefficient of determination as the evaluation index for the performance of the tidal volume prediction model of the ventilator and the cloud tidal volume prediction model; S37. Evaluate the magnitude of the coefficient of determination of the tidal volume prediction model of the ventilator and the cloud tidal volume prediction model. If the coefficient of determination of the cloud tidal volume prediction model is greater than the coefficient of determination of the tidal volume prediction model of the ventilator, update the tidal volume prediction model of the ventilator, otherwise, do not update; S38. According to the update result, the ventilator will reload the tidal volume prediction model as the current optimal tidal volume prediction model of the ventilator and continue to execute other tasks in the ventilator to ensure the stable operation of the device.

10. A prediction-driven air pressure control method for a household ventilator based on federated learning according to claim 9, characterized in that, The formula of the coefficient of determination is: ; where y i represents the true value of the sample; represents the predicted value of the tidal volume prediction model; represents the mean of the true values; represents the sum of squared residuals; represents the total sum of squares.

Citation Information

Cited By

  • Hyperventilation method for maintaining equal carbonic acid through exogenous CO2 gas and breathing device

    CN121588323A

  • A method and breathing device for maintaining isocarbonic acid through exogenous CO2 gas during hyperventilation

    CN121588323B