A diaphragm electromyographic stimulation waveform optimization method and device based on energy control

By using an energy-controlled diaphragmatic electrical stimulation waveform optimization method, and leveraging intelligent algorithms and hardware architecture to achieve dynamic energy constancy, the problem of energy instability in traditional diaphragmatic electrical stimulation systems is solved, thereby improving the reliability and safety of treatment.

CN122440985APending Publication Date: 2026-07-24YAOYI TECHNOLOGY (YUNNAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YAOYI TECHNOLOGY (YUNNAN) CO LTD
Filing Date
2026-03-20
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Traditional diaphragmatic electrical stimulation systems cannot dynamically match tissue impedance changes caused by individual differences, resulting in unstable energy that may cause muscle spasms, local pain, or nerve damage. Furthermore, existing technologies lack sufficient recognition accuracy in multi-task training, affecting efficacy and safety.

Method used

An energy-controlled diaphragmatic electrical stimulation waveform optimization method is adopted. By integrating multi-dimensional intelligent algorithms with a dedicated hardware architecture, multi-source data is collected in real time to build an intelligent evaluation model. The hyperparameters are optimized using the elite-based butterfly optimization algorithm to achieve dynamic constancy of stimulation energy and improve safety.

Benefits of technology

This has improved the reliability and safety of electrical stimulation therapy, significantly enhanced energy control precision and response speed, and provided more efficient and safer individualized adaptive treatment options.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122440985A_ABST
    Figure CN122440985A_ABST
Patent Text Reader

Abstract

The application discloses a diaphragm electromyographic stimulation waveform optimization method and device based on energy control, and relates to the technical fields of energy measurement and control and artificial intelligence. The method comprises the following steps: collecting multi-source data reflecting an electric stimulation process, preprocessing the multi-source data, and constructing a training data set based on the preprocessed multi-source data; constructing an intelligent evaluation model integrating time sequence feature mining and double-task prediction functions, and training the intelligent evaluation model in stages according to the training data set, so that the model has the joint prediction ability of the neural recruitment efficiency and the subjective comfort degree of different stimulation waveforms and parameter combinations; based on the joint prediction ability of the intelligent evaluation model, automatically optimizing the key hyperparameters of the model by using an elite base butterfly optimization algorithm; and taking the dynamic constancy of a preset target stimulation energy as a constraint condition, and deciding the optimal stimulation waveform and parameters according to the trained and hyperparameter-optimized intelligent evaluation model, so that the dual improvement of stimulation efficacy and safety is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the fields of energy measurement and control and artificial intelligence technology, and in particular to a method and device for optimizing diaphragmatic electrical stimulation waveforms based on energy control. Background Technology

[0002] Diaphragmatic electrical stimulation (DES) is a key technique for assisting respiratory function recovery and treating respiratory muscle fatigue, and it is widely used in clinical rehabilitation and intensive care. Traditional DES systems generally use constant current or constant voltage output modes. Their core drawback is that the impedance of the diaphragm and surrounding tissues changes in real time due to individual differences (such as muscle thickness and fat content) and physiological states (such as respiratory phase and tissue edema). The constant current / constant voltage mode cannot dynamically match impedance fluctuations. When tissue impedance increases, the actual energy transmitted to the nerves decreases significantly, resulting in a weakened stimulation effect. When impedance decreases, energy is excessively accumulated, which can easily cause muscle spasms, local pain, and even nerve or muscle tissue damage.

[0003] Clinical practice shows that stimulation energy is a core indicator directly related to efficacy and safety: too low energy fails to effectively recruit diaphragmatic motor units, while too high energy triggers pain nerve excitation. Therefore, maintaining a constant total energy for each stimulation pulse is an ideal approach to address individual differences and dynamic impedance issues. However, existing technologies suffer from several key bottlenecks, such as difficulty in precise energy measurement and control, lack of waveform-effect matching, insufficient accuracy in feature extraction and classification, low efficiency in pattern optimization, and a lack of dedicated hardware support. Furthermore, existing technologies are susceptible to sample imbalance during multi-task training, resulting in insufficient accuracy in identifying a few key categories such as overactivation and discomfort, further impacting the safety and personalized adaptability of stimulation protocols. Summary of the Invention

[0004] This invention addresses the problems in existing diaphragmatic electrical stimulation techniques, such as the inability of constant current or constant voltage control modes to cope with dynamic changes in tissue impedance, unstable stimulation energy, lack of intelligent decision-making in waveform optimization, and insufficient model prediction accuracy and optimization efficiency. It provides a diaphragmatic electrical stimulation waveform optimization method and device based on energy control. With constant stimulation energy as the core control objective, the diaphragmatic electrical stimulation method and device integrate multi-dimensional intelligent algorithms and dedicated hardware architecture to achieve a dual improvement in stimulation efficacy and safety.

[0005] In a first aspect, embodiments of the present invention provide a method for optimizing diaphragmatic electrical stimulation waveforms based on energy control, comprising:

[0006] Collect multi-source data reflecting the electrical stimulation process, preprocess the multi-source data, and construct a model training dataset based on the preprocessed multi-source data;

[0007] An intelligent evaluation model integrating temporal feature mining and dual-task prediction functions is constructed. The intelligent evaluation model is trained in stages based on the training dataset so that the model has the ability to jointly predict neural recruitment efficiency and subjective comfort for different stimulus waveforms and parameter combinations.

[0008] Based on the joint prediction capability of the intelligent evaluation model, the elite-based butterfly optimization algorithm is used to automatically optimize the key hyperparameters of the model.

[0009] With the dynamic constancy of the target stimulus energy as a pre-set constraint, and based on the intelligent evaluation model that has been trained and optimized by hyperparameters, the system decides on the stimulus waveform and parameters that achieve the best overall balance between neural recruitment efficiency and subjective comfort from the candidate stimulus waveforms and parameter combinations.

[0010] In a preferred embodiment, the multi-source data is preprocessed, and a model training dataset is constructed based on the preprocessed multi-source data, including:

[0011] The multi-source data is filtered and denoised, and outlier removal and missing value imputation are performed on the overall multi-source data.

[0012] Time-domain and frequency-domain features are extracted from the processed multi-source data to obtain a physiological feature set that integrates time-domain and frequency-domain features;

[0013] The stimulation parameters contained in the multi-source data are standardized and encoded with the physiological feature set.

[0014] The standardized and encoded stimulus parameters are fused with the physiological feature set to form a multidimensional feature vector, and the model training dataset is constructed based on the multidimensional feature vector.

[0015] In a preferred embodiment, the intelligent evaluation model integrating temporal feature mining and dual-task prediction functions includes a temporal feature extraction module and a dual-task classification module, wherein...

[0016] The temporal feature extraction module is constructed based on a transduced long short-term memory network and a spatial attention mechanism. It is used to perform temporal modeling on the input features and output deep temporal features with weights.

[0017] The dual-task classification module is constructed based on a hidden Markov model and combined with a first-order differential error adjustment mechanism. It is used to predict the neural recruitment efficiency level and subjective comfort level according to the deep temporal features and to dynamically correct the prediction results.

[0018] As a preferred embodiment, the intelligent evaluation model is trained in stages based on the training dataset, including at least the following stages:

[0019] In the first training phase, the trainable parameters of the temporal feature extraction module are frozen, and the parameters of the dual-task classification module are trained separately with the goal of maximizing the joint probability of the observed sequence and the real label.

[0020] In the second training phase, the trainable parameters of the temporal feature extraction module are unfrozen, and the parameters of the temporal feature extraction module and the dual-task classification module are jointly optimized with the weighted sum of the reconstruction loss of the temporal feature extraction module and the classification loss of the dual-task classification module as the objective.

[0021] In a preferred embodiment, the phased training process of the intelligent evaluation model further includes:

[0022] The classification loss of the dual-task classification module is configured with a class weighting mechanism, which configures class weights based on the differences in class sample distribution, so as to enhance the model's attention to and recognition accuracy of a few key classes;

[0023] An early stopping strategy is adopted, and a performance evaluation index is set in the strategy. Training is terminated when the evaluation index fails to improve for several consecutive iterations.

[0024] As a preferred implementation, based on the joint prediction capability of the intelligent evaluation model, the elite-based butterfly optimization algorithm is used to automatically optimize the key hyperparameters of the model, including:

[0025] The key hyperparameter combinations to be optimized in the intelligent evaluation model are encoded as search individuals in the optimization algorithm to form an initial population.

[0026] The fitness of each individual is evaluated based on the joint predictive performance of the intelligent evaluation model.

[0027] Based on the fitness, individuals with high fitness are selected from the initial population as elite individuals to form an elite subpopulation;

[0028] The population is iteratively updated by combining a global search guided by the best individual in the elite subgroup with a local search guided by random interactions within the elite subgroup.

[0029] When the preset optimization termination condition is met, the hyperparameter combination with the best output performance is taken as the optimization result.

[0030] In a preferred embodiment, individuals with high fitness are selected from the initial population based on their fitness to form an elite subpopulation, including:

[0031] All individuals in the initial population are sorted by their fitness, wherein the fitness is determined based on the joint prediction error quantification of the intelligent evaluation model;

[0032] Individuals with the highest fitness rankings are selected according to a preset ratio to form the elite subgroup.

[0033] As a preferred implementation, the population is iteratively updated by combining a global search guided by the best individual in the elite subgroup and a local search guided by random interactions within the elite subgroup, including:

[0034] Assign a global or local search strategy to each individual in the population based on a preset switching probability;

[0035] The global search causes the current individual to move to the location of the individual with the best fitness in the elite subgroup;

[0036] The local search allows the current individual to be updated by perturbing the position information of multiple randomly selected elite individuals within the elite subgroup.

[0037] In a preferred embodiment, the step of using the dynamic constancy of a preset target stimulus energy as a constraint, and based on a trained and hyperparameter-optimized intelligent evaluation model, determining the stimulus waveform and parameters that achieve the optimal balance between neural recruitment efficiency and subjective comfort from candidate stimulus waveforms and parameter combinations, includes:

[0038] Using the pre-set dynamic constancy of the target stimulus energy as a constraint, a subset that meets the energy tolerance range is selected from candidate waveforms and parameter combinations;

[0039] Based on the intelligent evaluation model, the neural recruitment efficiency and subjective comfort of the candidate combinations in the subset are jointly predicted, and a comprehensive score is calculated based on preset rules.

[0040] Based on the comprehensive score, the final output stimulus waveform and parameters are determined from the subset.

[0041] Secondly, embodiments of the present invention also provide an energy-controlled diaphragm electrical stimulation waveform optimization device, comprising:

[0042] The data acquisition and preprocessing module is used to collect multi-source data reflecting the electrical stimulation process, preprocess the multi-source data, and construct a model training dataset based on the preprocessed multi-source data.

[0043] The model building and training module is used to build an intelligent evaluation model that integrates temporal feature mining and dual-task prediction functions. The intelligent evaluation model is trained in stages according to the training dataset so that the model has the ability to jointly predict neural recruitment efficiency and subjective comfort for different stimulus waveforms and parameter combinations.

[0044] The model parameter optimization module is used to automatically optimize the key hyperparameters of the model based on the joint prediction capability of the intelligent evaluation model using the elite-based butterfly optimization algorithm.

[0045] The optimal stimulus waveform and parameter output module is used to determine the optimal stimulus waveform and parameters that achieve the best overall balance between neural recruitment efficiency and subjective comfort from candidate stimulus waveform and parameter combinations, based on the training and hyperparameter optimization of the intelligent evaluation model, under the constraint of the dynamic constancy of the preset target stimulus energy.

[0046] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:

[0047] One or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement an energy-controlled diaphragm electrical stimulation waveform optimization method according to any embodiment of the present invention.

[0048] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements an energy-controlled diaphragm electrical stimulation waveform optimization method as described in any embodiment of the present invention.

[0049] Compared with the prior art, the present invention achieves the following beneficial effects:

[0050] (1) This invention innovatively reconstructs the electrical stimulation control logic with the core of constant effective stimulation energy, and proposes a complete closed-loop scheme of real-time acquisition-precise calculation-dynamic feedback. By acquiring voltage, current and pulse width data in real time, the effective energy of each stimulation pulse is accurately calculated based on integral operation, and the output waveform parameters (amplitude and pulse width) are adaptively adjusted based on energy deviation to achieve dynamic constant energy control. This fundamentally solves the problem of insufficient adaptability of constant current / constant voltage mode to impedance fluctuations, and significantly improves the reliability and safety of electrical stimulation therapy.

[0051] (2) This invention constructs a spatial attention-enhanced transduced long short-term memory (TLSTM) network model. Addressing the high dimensionality and temporal correlation of stimulus parameters and physiological features, the model mines inter-sample correlation information through a transduction learning mechanism. It combines a spatial attention module to strengthen the weights of key physiological features such as EMG root mean square and peak frequency, suppressing irrelevant noise and improving the extraction accuracy of deep temporal features, providing high-value feature support for subsequent classification and optimization. It utilizes a combination of first-order differential error adjustment (FoD) and hidden Markov models (HMM). A dual-task HMM classification model is constructed to jointly predict neural recruitment efficiency and comfort, and FoD dynamically corrects the accumulation of classification errors, improving prediction accuracy and stability, providing a reliable basis for waveform optimization performance evaluation.

[0052] (3) This invention proposes an elite-based butterfly optimization algorithm (eBOA), which integrates the population search mechanism of the traditional butterfly optimization algorithm (BOA) with the elite group guidance characteristics for model optimization. First, the hyperparameter combination of the deep learning model is mapped to a "butterfly" population, and the fitness of the "butterfly" is quantified by the model classification error. Then, the top 20% of hyperparameter combinations with the smallest error are selected to construct an elite subgroup. The optimal parameters in the subgroup are used as the core to guide the global search (simulating butterflies gathering at the "most fragrant" position). At the same time, parameter combinations are randomly selected in the elite subgroup to achieve local search (simulating butterflies foraging locally). Through the coordinated optimization of global and local search, the algorithm's exploration (mining potential optimal parameters) and exploitation (refining high-quality parameters) capabilities are balanced, solving the problems of slow convergence and easy getting trapped in local optima in traditional optimization algorithms (such as genetic algorithms and basic BOA). Finally, the accuracy and stability of the configuration of model hyperparameters (such as the number of hidden layer nodes of TLSTM and the number of HMM states) are improved.

[0053] (4) The present invention designs a dedicated circuit structure to meet the requirements of the method, forming a hardware closed loop of high-precision energy measurement and control circuit + energy feedback control module + adaptive waveform generator. This hardware architecture realizes millisecond-level closed-loop control of energy calculation, deviation feedback and waveform adjustment, perfectly matching the real-time response requirements of clinical electrical stimulation, providing reliable hardware support for the deep integration of multi-dimensional intelligent algorithms and constant energy control logic, and ensuring the efficient implementation of the technical solution from theory to clinical application.

[0054] (5) This invention redefines the electrical stimulation control logic with energy as the core variable, deeply integrates multi-dimensional intelligent algorithms with circuit layer control, breaks through the technical bottleneck of traditional constant current / constant voltage control, and significantly improves the energy control accuracy, response speed and individual adaptability of diaphragmatic electrical stimulation therapy, thereby providing a more efficient, safer and smarter solution for clinical rehabilitation and respiratory assisted therapy. Attached Figure Description

[0055] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings. The drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0056] Figure 1 This is a flowchart of the energy-controlled diaphragm electrical stimulation waveform optimization method provided in the embodiments of the present invention;

[0057] Figure 2 This is a framework diagram of the energy-controlled diaphragm electrical stimulation waveform optimization method provided in the embodiments of the present invention;

[0058] Figure 3 This is a flowchart of the elite-based butterfly optimization algorithm (eBOA) provided in an embodiment of the present invention;

[0059] Figure 4 This is a flowchart illustrating the construction and training process of the intelligent evaluation model provided in this embodiment of the invention;

[0060] Figure 5 This is a schematic diagram of the energy-controlled diaphragm electrical stimulation waveform optimization device provided in an embodiment of the present invention;

[0061] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0062] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0063] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of the operations (or steps) can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but it may also have additional steps not included in the figures. The process may correspond to a method, function, procedure, subroutine, subroutine, etc.

[0064] This invention takes constant stimulus energy as its core constraint, and combines precise energy measurement and control circuitry with an AI optimization module to achieve dynamic matching of energy, waveform, and physiological response. It is implemented collaboratively by a hardware circuit module and a software algorithm module, specifically including:

[0065] Energy measurement and control circuit: Real-time acquisition of instantaneous voltage and current data from stimulation pulses, accurate calculation of effective energy, and feedback to the control module; employs a high-frequency sampling chip (sampling rate...). The voltage signal (via series voltage divider resistors) and current signal (via parallel current sensor) of the stimulation circuit are acquired synchronously; the real-time integration calculation of the above effective energy formula is implemented based on the FPGA chip, ensuring that the energy calculation is completed within 1ms after each pulse output; a built-in energy calibration unit is used, through a standard resistive load ( Regularly calibrate measurement accuracy to ensure energy calculation errors. .

[0066] Energy feedback control module: With constant effective energy as the core constraint, it automatically adjusts the parameters of the stimulation waveform to counteract the influence of tissue impedance changes on energy; and sets the target energy. (Initial configuration based on patient weight and diaphragmatic function assessment results, range:) ); if the measured energy (If tissue impedance increases), then the voltage amplitude is increased proportionally (step size: 0.1V) or the pulse width is extended (step size: 0.1ms); if (If tissue impedance decreases), then the voltage amplitude should be reduced proportionally or the pulse width shortened; the constraint is: voltage amplitude pulse width To avoid exceeding the human body's safety threshold.

[0067] Example 1: As Figure 1 The diagram shows a flowchart of a diaphragm electrical stimulation waveform optimization method 100 based on energy control, as provided in Embodiment 1 of the present invention. The method 100 specifically includes the following steps:

[0068] S110. Collect multi-source data reflecting the electrical stimulation process, preprocess the multi-source data, and construct a model training dataset based on the preprocessed multi-source data.

[0069] This embodiment focuses on the requirements of deep learning models for the integrity, reliability, and adaptability of input data. Through a full-process processing of multi-source data acquisition, data cleaning and anomaly handling, feature engineering, and data standardization, a high-quality training dataset is constructed, providing reliable input support for the subsequent model to accurately learn the mapping relationship between stimulus parameters, physiological response, and subjective comfort.

[0070] Preferably, in order to comprehensively cover the key factors affecting the effect of diaphragmatic electrical stimulation, a synchronous acquisition system is designed to collect stimulation parameter data, physiological response data, and subjective feedback data based on the physiological characteristics and clinical needs of diaphragmatic electrical stimulation, so as to ensure the timeliness and relevance of the data.

[0071] Among them, the stimulation parameter data: the key parameters of each stimulation pulse are recorded in real time by the energy measurement and control circuit, including waveform type (covering 6 common types such as exponential rising wave, bi-symmetrical wave, trapezoidal wave, square wave, triangular wave and sawtooth wave), time domain parameters (rise time, plateau time and fall time, all in milliseconds), and effective energy (in millijoules, calculated by the energy measurement and control circuit); the acquisition frequency is synchronized with the stimulation frequency, and a complete set of parameters is recorded for each output pulse.

[0072] Physiological response data: Objective indicators of diaphragmatic activation were collected using non-invasive sensors to avoid additional trauma to the patient. These included diaphragmatic electromyography (EMG) signals and thoracic displacement data. EMG data was collected via surface electrodes attached to the diaphragm projection area below the xiphoid process, with a sampling frequency of 2 kHz covering the main frequency bands of EMG signals. Each acquisition lasted 10 seconds, focusing on recording the amplitude and frequency of the EMG signals, reflecting the intensity of nerve activation. Thoracic displacement data were measured using an infrared distance sensor at the suprasternal notch, with a sampling frequency of 100 Hz. The thoracic expansion amplitude was calculated to quantify the diaphragmatic contraction effect. Timing control: Each stimulation parameter combination was applied continuously for 30 seconds, and EMG and thoracic displacement data were collected synchronously only after the physiological response stabilized to avoid errors caused by transient responses.

[0073] Subjective feedback data: The visual analog scale (VAS) commonly used in clinical practice was used to collect patients' subjective comfort level. The scoring range was 0-10 points, where 0 points indicated no discomfort and 10 points indicated unbearable pain. The scores were divided into three levels: 0-2 points for comfortable, 3-6 points for tolerable, and 7-10 points for uncomfortable. To avoid patient fatigue caused by frequent scoring, subjective feedback was collected once after every 3 sets of stimulation parameters were adjusted.

[0074] The dataset size is designed to fully consider the model's generalization ability requirements: it needs to cover 50-100 different individuals (including healthy people and patients with diaphragmatic dysfunction, aged 20-70 years old), and collect 200-300 sets of matching samples of "stimulus parameters-physiological response-subjective feedback" for each individual, ensuring that the total number of samples is not less than 10,000 sets to meet the training requirements of the deep learning model.

[0075] Preferably, to remove noise, outliers, and missing values ​​from the collected data and ensure data reliability, clinically recognized standardized processing methods are adopted:

[0076] EMG signal denoising: A combination of 50Hz notch filter and 10-500Hz bandpass filter is used to remove power frequency interference and electromyographic artifacts (such as muscle tremors and electrode contact noise) to ensure that the EMG signal can truly reflect the diaphragmatic nerve activation state.

[0077] Outlier removal: The interquartile range (IQR) method was used to screen for outliers in continuous variables such as effective energy, EMG amplitude, chest expansion amplitude, and VAS score. Outliers were defined as samples that exceeded "25th percentile - 1.5 × IQR" or "75th percentile + 1.5 × IQR". Marked outlier samples were directly removed to ensure that the remaining effective sample ratio was not less than 95%.

[0078] Missing value imputation: For the small number of missing values ​​(≤5%) that may exist in the subjective feedback data, the K-nearest neighbor (KNN) algorithm is used for imputation. The similarity judgment is based on the stimulus parameters and EMG features. The average VAS score of the 5 most similar samples is selected as the imputation value to avoid missing data affecting model training.

[0079] Preferably, to further extract high-discrimination features, unify data scale, reduce model training difficulty, and improve learning efficiency, the following time-series feature extraction and feature fusion processing are performed:

[0080] Time-series feature extraction: Feature extraction is performed on EMG signals and thoracic displacement signals, including time-domain features (EMG root mean square, peak value, and thoracic displacement expansion velocity) and frequency-domain features (EMG peak frequency and total power, obtained through fast Fourier transform), which can directly reflect the efficiency of nerve recruitment and the intensity of diaphragmatic contraction.

[0081] Feature fusion: Stimulation parameters (waveform type, time domain parameters, effective energy) and physiological features (EMG features, thoracic displacement features) are fused into a model input vector with a total of 10 dimensions, comprehensively covering the key factors affecting the stimulation effect.

[0082] Data standardization: Z-score standardization is used for continuous features such as rise time, effective energy, and EMG root mean square to eliminate dimensional differences; discrete features such as waveform type are converted into binary vectors using one-hot encoding to ensure that the model can effectively process category information and avoid training bias caused by differences in feature scale.

[0083] In summary, through the entire process of multi-source data acquisition, data cleaning and anomaly handling, feature engineering and data standardization, the constructed training dataset possesses completeness, reliability, and adaptability. It comprehensively covers the core influencing factors of diaphragmatic electrical stimulation, and the rigorous cleaning and standardization processes ensure data quality, laying a solid foundation for the accurate training and efficient learning of subsequent deep learning models.

[0084] S120. Construct an intelligent evaluation model that integrates temporal feature mining and dual-task prediction functions. Train the intelligent evaluation model in stages according to the training dataset so that the model has the ability to jointly predict neural recruitment efficiency and subjective comfort for different stimulus waveforms and parameter combinations.

[0085] This embodiment focuses on accurately extracting temporal features and efficiently achieving joint prediction for dual tasks. It constructs a deep learning model for feature extraction and multi-task prediction, innovatively employing a fusion technique of a spatial attention-enhanced transduced long short-term memory network (TLSTM) and a first-order differential error adjustment (FoD)-Hidden Markov Model (HMM) to simultaneously achieve high-precision prediction of neural recruitment efficiency and comfort. The entire process includes three core sub-steps: model architecture design, phased training, and loss function optimization. Figure 4 As shown, the specific implementation steps are as follows: (a) - (c):

[0086] (a) Deep learning model architecture design

[0087] (a-1) This step adopts a two-stage architecture of feature extraction-dual-task classification. The first stage focuses on deep temporal feature mining, and the second stage achieves accurate prediction and error correction of dual objectives. The architecture has a closed-loop logic and is adapted to the characteristics of diaphragmatic electrical stimulation data.

[0088] In this embodiment, to address the high dimensionality and temporal correlation of the stimulus parameter-physiological feature input, a synergistic approach using TLSTM and spatial attention mechanisms is employed to extract high-value deep features.

[0089] The input layer receives the normalized input vector output in step S110. (10-dimensional), transformed into a 256-dimensional feature vector through an embedding layer. The TLSTM layer contains two stacked TLSTM units, with 128 hidden nodes in each layer. It mines the correlation information between samples through a transduction learning mechanism. The core update formula of TLSTM is:

[0090]

[0091] in, Input gate: Used to control the input features at the current time step. Cell state The update ratio, with a value range of [0,1]; Forget gate: Used to control the cell state at the previous moment. The retention ratio, with a value range of [0,1]; Output gate, used to control cell state. For hidden state The output ratio, with a value range of [0,1]; Cell state, storing long-term temporal characteristic information under diaphragmatic electrical stimulation scenarios; Hidden state The input feature vector at time t. The cell state at the previous moment stores long-term temporal characteristic information of diaphragmatic electrical stimulation accumulated from historical moments; : The hidden state of the previous time step, storing short-term effective feature information of the output of historical time steps; tanh: Hyperbolic tangent activation function; Element-wise multiplication (Hadamard product). Input features To the input gate The weight matrix; The state that was hidden a moment ago. To the input gate The weight matrix, : Cell state at the previous moment To the input gate The weight matrix, Input features To the Gate of Oblivion The weight matrix, The state that was hidden a moment ago. To the Gate of Oblivion The weight matrix, : Cell state at the previous moment To the Gate of Oblivion The weight matrix; Input features The weight matrix updated to the cell state; The state that was hidden a moment ago. The weight matrix for cell state updates. Input features To the output gate The weight matrix, The state that was hidden a moment ago. To the output gate The weight matrix, Current cell state To the output gate The weight matrix, Input gate The bias term, Forgotten Gate The bias term, : Bias term for cell state update Output gate The bias term.

[0092] The spatial attention layer adds a spatial attention module after the TLSTM output, calculating the attention weight for each feature dimension. The formula for enhancing key features and suppressing noise is:

[0093]

[0094] in, Hidden state Attention weight parameters corresponding to the j-th dimension feature; Attention bias term of the j-th dimension feature. Hidden state The attention weight parameter corresponding to the k-th feature dimension : Attention bias term for the k-th feature dimension.

[0095] Finally, the final feature vector is obtained through weighted summation. (128-dimensional), this module can enhance EMG-related features (such as...) The weights are adjusted to suppress irrelevant noise.

[0096] (a-2) Dual-task classification: FoD-HMM fusion model

[0097] The dual-task classification module is constructed based on a Hidden Markov Model (FoD) combined with a first-order differential error adjustment mechanism (HMM). It is used to predict the neural recruitment efficiency level and subjective comfort level of the final output feature vector F (128 dimensions) of the TLSTM layer and the spatial attention layer, and dynamically corrects the prediction results. Specifically, it includes the following tasks 1-3:

[0098] Task 1: Classification of Neural Recruitment Efficiency

[0099] Preferably, the diaphragm activation intensity is divided into 5 levels (denoted as...). Discrete values ​​1-5: Level 1 (no activation), Level 2 (weak activation), Level 3 (moderate activation), Level 4 (good activation), Level 5 (overactivation), with... and The joint threshold is used as the basis for annotation (e.g., the root mean square value of the diaphragm electromyography signal). And the extent of chest expansion (Level 4).

[0100] Furthermore, Hidden Markov Models (HMMs) are used for classification, with the number of states in the HMM set to 5 (corresponding to the efficiency level), and the observations are the features output by the TLSTM. The core parameters of an HMM include:

[0101] State transition matrix ( From state Transition to state The probability); for example This indicates the probability that if the previous level was 3 (moderate activation), the current level will be 4 (good activation), which is adapted to the dynamic change of activation intensity in diaphragmatic electrical stimulation.

[0102] Observation probability matrix ( For state Observed features (probability)

[0103] Initial state probability (Initially in state) The probability of observation (features); the HMM parameters are trained using the Baum-Welch algorithm to make the observed sequence (features) The probability of () is maximized. The Baum-Welch algorithm is the parameter training algorithm for Hidden Markov Models (HMMs), which iteratively optimizes the state transition matrix. Observation probability matrix Initial state probability , so that the observation sequence (feature vector) By maximizing the probability of occurrence of ), the optimal HMM parameters that fit the diaphragm electrical stimulation data are finally obtained.

[0104] Task 2: Comfort Category:

[0105] Preferably, subjective feedback Mapped to level 3 comfort (denoted as ) Discrete values ​​1-3): Level 1 (Comfort, Level 2 (Tolerable) Level 3 (Discomfort) ).

[0106] Furthermore, the HMM architecture is reused, with the number of states set to 3, and the observations still serving as features. State transition matrix for independent training of comfort classification Observation probability matrix for comfort classification and the initial state probability of comfort classification .

[0107] Task 3: First-order differential error adjustment (FoD)

[0108] Preferably, to address the problem of HMM classification error accumulation, this embodiment proposes to dynamically adjust the model output through FoD: calculating the differential prediction error of neighboring samples. ,when ( When the error threshold is set to 0.2, the error adjustment mechanism is triggered, and the formula is:

[0109]

[0110]

[0111] in, Classification error at any given time; The classification error at time t, and (2) The actual comfort level, based on VAS rating mapping, is the benchmark reference for the classification task; The initial predicted label at time step, Error threshold (set to 0.2); The final predicted label after time adjustment; Adjustment factor (set to 0.1). Error sign function: Used to determine the direction of the error.

[0112] (b) Phased training strategy:

[0113] The intelligent evaluation model is trained in stages based on the training dataset to ensure stable convergence and accurate predictions. This training includes the following stages:

[0114] In the first training phase, the trainable parameters of the temporal feature extraction module are frozen, and the parameters of the dual-task classification module are trained separately with the goal of maximizing the joint probability of the observed sequence and the real label.

[0115] Specifically, the weights of TLSTM are fixed, and only the parameters of the HMM are trained. ), employing supervised learning methods, with observation sequences (features) ) and real labels The log-likelihood loss is the objective function:

[0116]

[0117] in, : The true label of the neural recruitment efficiency of the i-th sample, based on and Joint annotation is the core benchmark for HMM classification; : The true comfort label of the i-th sample, based on VAS rating mapping, is another benchmark for HMM dual-task classification; : Conditional probability, the larger the value, the higher the matching degree between the HMM parameters and the sample; Total number of training samples (total sample size of the diaphragmatic electrical stimulation dataset) (Group). Preferably, the first training phase has 50 iterations, a learning rate of 0.01, and uses the Adam optimizer.

[0118] In the second training phase, the trainable parameters of the temporal feature extraction module are unfrozen. The parameters of the temporal feature extraction module and the dual-task classification module are jointly optimized with the goal of calculating the weighted sum of the reconstruction loss of the temporal feature extraction module and the classification loss of the dual-task classification module. Specifically, the TLSTM weights are unfrozen, and the TLSTM and HMM are jointly trained. The objective function is the weighted sum of the feature extraction loss of the TLSTM and the classification loss of the HMM.

[0119]

[0120]

[0121] in, Mean squared error loss, TLSTM feature extraction loss, The total loss function during the joint training phase. Loss weighting factor (set to 0.3); : The true feature vector of the i-th sample (128 dimensions); : The TLSTM predicted feature vector (128 dimensions) of the i-th sample.

[0122] Preferably, the second training phase has 100 iterations, a cosine annealing learning rate (initial 0.001, final 0.0001), a batch size of 32, and an early stopping strategy (training stops if the validation set error does not decrease for 5 consecutive iterations) to avoid overfitting.

[0123] (c) Training optimization and supplementation

[0124] Specifically, this embodiment addresses the sample imbalance problem in multi-task training by employing a weighted loss function to adjust the HMM classification loss. Introducing category weights (The smaller the sample size, the greater the weight of the category), the formula is:

[0125]

[0126]

[0127] in, Weighted HMM classification loss, in the original Introducing category weights on this basis This causes the classification error of minority class samples to account for a higher proportion of the total loss; Class weights are used to balance the contributions of different classes in the loss calculation. : The category weight of neural recruitment efficiency corresponding to the i-th sample, and the true rank of that sample. (Levels 1-5) Matching; : The comfort category weight corresponding to the i-th sample; Total number of categories, divided into two types of tasks: ① Classification of neural recruitment efficiency (Levels 1-5); ② Comfort Classification (Levels 1-3) are used for standardization of weight calculation; :category Sample size

[0128] First item Weighted neural recruitment efficiency classification loss, through Increase the proportion of loss for a few levels (such as level 5 overactivation) to ensure that the model can recognize a balanced range of activation intensities.

[0129] Second item Weighted comfort classification loss, through Increase the proportion of loss for a few levels (such as level 3 discomfort) to avoid the model neglecting the learning of uncomfortable samples due to the abundance of comfortable samples.

[0130] The above weighted loss improves the model's recognition rate for minority categories by 25%.

[0131] S130. Based on the joint prediction capability of the intelligent evaluation model, the key hyperparameters of the model are automatically optimized using the elite-based butterfly optimization algorithm.

[0132] The core objective of this step is to optimize the key hyperparameters of the deep learning model using the eBOA algorithm, addressing the slow convergence and susceptibility to local optima issues common in traditional optimization algorithms. This aims to improve the model's joint prediction accuracy and stability regarding neural recruitment efficiency and subjective comfort, providing high-performance model support for subsequent waveform optimization decisions. eBOA integrates the population search mechanism of the traditional Butterfly Optimization (BOA) algorithm with the guiding characteristics of elite subgroups, retaining global exploration capabilities while strengthening the directional guidance of high-quality parameters, such as... Figure 3 As shown, it includes the following steps:

[0133] The key hyperparameter combinations to be optimized in the intelligent evaluation model are encoded as search individuals in the optimization algorithm to form an initial population.

[0134] The fitness of each individual is evaluated based on the joint prediction performance of the intelligent evaluation model.

[0135] All individuals in the initial population are sorted by their fitness, wherein the fitness is determined based on the joint prediction error quantification of the intelligent evaluation model;

[0136] Individuals with the highest fitness rankings are selected according to a preset ratio to form the elite subgroup.

[0137] The population is iteratively updated by combining a global search guided by the best individual in the elite subgroup and a local search guided by random interactions within the elite subgroup, and assigning a global search or local search strategy to each individual in the population based on a preset switching probability.

[0138] When the preset optimization termination condition is met, the hyperparameter combination with the best output performance is taken as the optimization result.

[0139] The global search moves the current individual to the location of the individual with the best fitness in the elite subgroup; the local search updates the current individual within the elite subgroup by perturbing the location information of multiple randomly selected elite individuals.

[0140] Specifically, this includes the following steps (d) - (g).

[0141] (d) Adaptation of the core mechanism of the traditional Butterfly Optimization Algorithm (BOA):

[0142] First, based on the core principles of the butterfly optimization algorithm and combined with the hyperparameter optimization requirements of the diaphragm electrical stimulation model, the basic search logic is defined as follows:

[0143] (d-1) Butterfly behavior mapping:

[0144] Each hyperparameter combination is considered as a "butterfly". The "position" of the butterfly corresponds to the hyperparameter configuration (e.g., the number of hidden layer nodes in TLSTM = 128 + the number of HMM states = 5), and the "fragrance concentration" corresponds to the fitness of the parameter combination (calculated based on the model classification error; the smaller the error, the higher the fitness, and the stronger the "fragrance").

[0145] (d-2) Core assumption fit:

[0146] Hypothesis 1: All “butterflies” (hyperparameter combinations) can release “fragrance” (corresponding to fitness), and the higher the fitness of a combination, the stronger its attraction to other combinations;

[0147] Hypothesis 2: "Butterfly" movement rule adapts to hyperparameter optimization - either move towards the elite parameter combination with the "most intense aroma" (global search), or move randomly within the elite subgroup (local search).

[0148] Hypothesis 3: The "stimulus intensity" is determined by the fitness of the hyperparameter combination. The higher the fitness, the stronger the guiding effect on the surrounding "butterflies".

[0149] (d-3) Basic parameter initialization:

[0150] Population size: set to 50 (i.e., simultaneously optimizing 50 sets of hyperparameter combinations), covering key hyperparameters such as the number of TLSTM hidden layer nodes (64-256, step size 32), the number of HMM neural recruitment efficiency states (3-7 levels), the number of HMM comfort states (2-4 levels), and the initial learning rate (0.0005-0.005, step size 0.0005); sensory modality parameters. The initial value is set to 0.8, and it decreases linearly to 0.1 with each iteration to balance global exploration and local exploitation; switching probability. Set to 0.6 to determine whether the "butterfly" uses a global search (moving towards the optimal parameters for elites) or a local search (fine-tuning within the elite subgroup).

[0151] (e) Constructing an elite subgroup:

[0152] Select the model with the smallest error during training Parameter combination as elite subgroup Provides high-quality guidance for BOA search:

[0153] For the initial population of 50 hyperparameter combinations, TLSTM+HMM was trained for each combination, and the average classification error of the 5-fold cross-validation was calculated for each combination. The top 10 combinations were selected by sorting them from smallest to largest error. The parameter combinations with the smallest error form the elite subgroup. Combinations within this subgroup enable the model to achieve high accuracy in both neural recruitment efficiency and comfort prediction (e.g., Its hyperparameter configuration is closer to the optimal solution space; the parameter combination with the smallest error in the elite subgroup is marked as the "optimal elite". (Optimal parameters in generation g) serve as the core guiding objective for the global search.

[0154] (f) Global search optimization by integrating BOA:

[0155] Based on the global search mechanism of BOA, the "optimal elite" of the elite subgroup is selected. To guide the population, the positions of all "butterflies" (hyperparameter combinations) are adjusted, and the formula is adapted as follows:

[0156]

[0157] in, : The position of the i-th butterfly in the g-th generation (hyperparameter combination), corresponding to the current foraging position of the butterfly in BOA; : No. The i-th hyperparameter combination is a new candidate configuration generated after global search optimization, compared to... Closer to the optimal hyperparameter space; The position of the "optimal elite" in the g-th generation (the hyperparameter combination with the smallest error in the elite subgroup) corresponds to the target position of "most fragrant" in BOA, guiding other butterflies to move towards it; The decay coefficient (same as step 3.1, decreasing from 0.8 to 0.1 with each iteration) corresponds to the "sensory modality" parameter in BOA, controlling the search range—in the early stages of iteration. Large, allowing "butterflies" to Large-scale movement (global exploration); late iteration Small, only Small-scale adjustments in the vicinity (local convergence); rand: Random numbers correspond to the randomness of the butterfly's movement in BOA, preventing the algorithm from getting trapped in local optima; Fitness of the i-th "butterfly" in generation g (calculated based on model classification error, normalized to 0). ), corresponding to the "fragrance concentration" of butterflies in BOA - the higher the adaptability, The larger it gets, the more the "butterfly" moves towards The greater the range of movement, the faster the spread of high-quality parameters.

[0158] This step simulates the behavior of butterflies in the BOA (Butterfly Association) clustering towards the location with the "strongest fragrance," through the "optimal elite." The guidance enables the population to quickly approach the hyperparameter space of the diaphragmatic electrical stimulation model, avoiding the problem of strong blindness in the traditional BOA global search.

[0159] (g) Local search optimization with BOA integration

[0160] Based on the local search mechanism of BOA, in the elite subgroup Internally, "butterflies" (parameter combinations) are randomly selected for fine-tuning to prevent excessive population aggregation. However, if it gets stuck in a local optimum, the formula is adapted as follows:

[0161]

[0162] in, : The gth generation elite subgroup Three sets of hyperparameters were randomly selected from the data, corresponding to three butterflies randomly selected within a local range in the BOA, ensuring a high-quality foundation for the local search; other parameters ( The meaning is the same as global search, corresponding to the randomness of BOA and the "aroma concentration" guidance, respectively.

[0163] This step simulates the behavior of butterflies randomly foraging within a local area in the BOA (Boolean Array of Assorted Behaviors). Through the interaction of three sets of high-quality parameters within the elite subgroup, the current parameter combination is optimized. Fine-tuning is performed to both preserve the superior characteristics of elite parameters (such as adapting the number of TLSTM nodes to the timing characteristics of diaphragmatic electrical stimulation) and introduce local variations (such as fine-tuning the number of HMM states) to avoid missing out on better hyperparameter configurations.

[0164] When the number of iterations reaches 50 generations, or when there are 5 consecutive generations of "top elite" results... Classification error fluctuation When the time is right, stop optimization and output the hyperparameter configuration corresponding to the current "best elite".

[0165] S140. With the preset target stimulus energy being dynamically constant as a constraint, and based on the intelligent evaluation model that has been trained and optimized by hyperparameters, the stimulus waveform and parameters that achieve the best overall combination of neural recruitment efficiency and subjective comfort are determined from the candidate stimulus waveforms and parameter combinations.

[0166] The core objective of this step is to achieve a triple balance between efficacy (neural recruitment efficiency), safety (comfort), and energy stability, under the core constraint of dynamic constancy of stimulation energy, combined with an optimized intelligent assessment model. This ensures that the decision-making results are adapted to individual dynamic changes in impedance and clinical needs, as detailed below:

[0167] Using the pre-set dynamic constancy of the target stimulus energy as a constraint, a subset of candidate waveforms and parameter combinations that meet the energy tolerance range are selected. Specifically, the pre-set target stimulus energy range is 0.5-5 mJ (configured based on patient weight and diaphragmatic function assessment results), and the energy tolerance range is... As a constraint, from more than 500 candidate combinations generated by the built-in waveform library (including 6 basic waveforms such as exponential rising wave and double symmetrical wave, supporting parameterized adjustment of rise time 0.1-10ms, flat-top time 0-20ms, and fall time 0.1-5ms), a subset of expected transferred energy falls within the target energy tolerance range, and invalid combinations that exceed the energy limit are eliminated;

[0168] According to the intelligent evaluation model, the neural recruitment efficiency and subjective comfort of the candidate combinations in the subset are jointly predicted, and the comprehensive score is calculated based on the preset rules. Specifically, the effective candidate subset is input into the intelligent evaluation model, and the neural recruitment efficiency level (level 1-5) and subjective comfort level (level 1-3) of each combination are output simultaneously. The weighted scoring rules are set based on clinical needs, and the comprehensive score of each combination is calculated.

[0169] Based on the comprehensive score, the final output stimulus waveform and parameters are determined from the subset. The three combinations with the highest comprehensive scores are selected as alternative schemes, combined with the real-time energy deviation (calculated by the energy measurement and control circuit, error). Adaptive fine-tuning is performed.

[0170] Based on the above embodiments, the present invention achieves the following beneficial effects:

[0171] (1) This invention innovatively reconstructs the electrical stimulation control logic with the core of constant effective stimulation energy, and proposes a complete closed-loop scheme of real-time acquisition-precise calculation-dynamic feedback. By acquiring voltage, current and pulse width data in real time, the effective energy of each stimulation pulse is accurately calculated based on integral operation, and the output waveform parameters (amplitude and pulse width) are adaptively adjusted based on energy deviation to achieve dynamic constant energy control. This fundamentally solves the problem of insufficient adaptability of constant current / constant voltage mode to impedance fluctuations, and significantly improves the reliability and safety of electrical stimulation therapy.

[0172] (2) This invention constructs a spatial attention-enhanced transduced long short-term memory (TLSTM) network model. Addressing the high dimensionality and temporal correlation of stimulus parameters and physiological features, the model mines inter-sample correlation information through a transduction learning mechanism. It combines a spatial attention module to strengthen the weights of key physiological features such as EMG root mean square and peak frequency, suppressing irrelevant noise and improving the extraction accuracy of deep temporal features, providing high-value feature support for subsequent classification and optimization. It utilizes a combination of first-order differential error adjustment (FoD) and hidden Markov models (HMM). A dual-task HMM classification model is constructed to jointly predict neural recruitment efficiency and comfort, and FoD dynamically corrects the accumulation of classification errors, improving prediction accuracy and stability, providing a reliable basis for waveform optimization performance evaluation.

[0173] (3) This invention proposes an elite-based butterfly optimization algorithm (eBOA), which integrates the population search mechanism of the traditional butterfly optimization algorithm (BOA) with the elite group guidance characteristics for model optimization. First, the hyperparameter combination of the deep learning model is mapped to a "butterfly" population, and the fitness of the "butterfly" is quantified by the model classification error. Then, the top 20% of hyperparameter combinations with the smallest error are selected to construct an elite subgroup. The optimal parameters in the subgroup are used as the core to guide the global search (simulating butterflies gathering at the "most fragrant" position). At the same time, parameter combinations are randomly selected in the elite subgroup to achieve local search (simulating butterflies foraging locally). Through the coordinated optimization of global and local search, the algorithm's exploration (mining potential optimal parameters) and exploitation (refining high-quality parameters) capabilities are balanced, solving the problems of slow convergence and easy getting trapped in local optima in traditional optimization algorithms (such as genetic algorithms and basic BOA). Finally, the accuracy and stability of the configuration of model hyperparameters (such as the number of hidden layer nodes of TLSTM and the number of HMM states) are improved.

[0174] (4) The present invention designs a dedicated circuit structure to meet the requirements of the method, forming a hardware closed loop of high-precision energy measurement and control circuit + energy feedback control module + adaptive waveform generator. This hardware architecture realizes millisecond-level closed-loop control of energy calculation, deviation feedback and waveform adjustment, perfectly matching the real-time response requirements of clinical electrical stimulation, providing reliable hardware support for the deep integration of multi-dimensional intelligent algorithms and constant energy control logic, and ensuring the efficient implementation of the technical solution from theory to clinical application.

[0175] (5) This invention redefines the electrical stimulation control logic with energy as the core variable, deeply integrates multi-dimensional intelligent algorithms with circuit layer control, breaks through the technical bottleneck of traditional constant current / constant voltage control, and significantly improves the energy control accuracy, response speed and individual adaptability of diaphragmatic electrical stimulation therapy, thereby providing a more efficient, safer and smarter solution for clinical rehabilitation and respiratory assisted therapy.

[0176] Example 2: Figure 5 This is a schematic diagram of a diaphragm electrical stimulation waveform optimization device based on energy control, provided in Embodiment 2 of the present invention. Figure 5 As shown, the device includes:

[0177] The data acquisition and preprocessing module 510 is used to collect multi-source data reflecting the electrical stimulation process, preprocess the multi-source data, and construct a model training dataset based on the preprocessed multi-source data.

[0178] The model building and training module 520 is used to build an intelligent evaluation model that integrates temporal feature mining and dual-task prediction functions. The intelligent evaluation model is trained in stages according to the training dataset so that the model has the ability to jointly predict neural recruitment efficiency and subjective comfort for different stimulus waveforms and parameter combinations.

[0179] The model parameter optimization module 530 is used to automatically optimize the key hyperparameters of the model based on the joint prediction capability of the intelligent evaluation model using the elite-based butterfly optimization algorithm.

[0180] The optimal stimulus waveform and parameter output module 540 is used to determine the optimal stimulus waveform and parameters that achieve the best overall balance between neural recruitment efficiency and subjective comfort from candidate stimulus waveform and parameter combinations, based on a trained and hyperparameter-optimized intelligent evaluation model, under the constraint of the dynamic constancy of the preset target stimulus energy.

[0181] The energy-controlled diaphragm electrical stimulation waveform optimization device provided in the embodiments of the present invention can execute the energy-controlled diaphragm electrical stimulation waveform optimization method provided in any of the embodiments of the present invention, and has the corresponding functions and beneficial effects of executing the energy-controlled diaphragm electrical stimulation waveform optimization method. For detailed process, please refer to the relevant operations of the energy-controlled diaphragm electrical stimulation waveform optimization method in the foregoing embodiments.

[0182] Example 3: Figure 6 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, and may also represent various forms of mobile devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the invention described and / or claimed herein.

[0183] like Figure 6 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0184] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0185] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 executes the energy-controlled diaphragmatic electrical stimulation waveform optimization method described above.

[0186] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0187] The above embodiments are merely illustrative examples and are not intended to limit the implementation. Those skilled in the art will recognize that various variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A method for optimizing diaphragmatic electrical stimulation waveforms based on energy control, characterized in that, include: Collect multi-source data reflecting the electrical stimulation process, preprocess the multi-source data, and construct a model training dataset based on the preprocessed multi-source data; An intelligent evaluation model integrating temporal feature mining and dual-task prediction functions is constructed. The intelligent evaluation model is trained in stages based on the training dataset so that the model has the ability to jointly predict neural recruitment efficiency and subjective comfort for different stimulus waveforms and parameter combinations. Based on the joint prediction capability of the intelligent evaluation model, the elite-based butterfly optimization algorithm is used to automatically optimize the key hyperparameters of the model. With the dynamic constancy of the target stimulus energy as a pre-set constraint, and based on the intelligent evaluation model that has been trained and optimized by hyperparameters, the system decides on the stimulus waveform and parameters that achieve the best overall balance between neural recruitment efficiency and subjective comfort from the candidate stimulus waveforms and parameter combinations.

2. The method according to claim 1, characterized in that, The multi-source data is preprocessed, and a model training dataset is constructed based on the preprocessed multi-source data, including: The multi-source data is filtered and denoised, and outlier removal and missing value imputation are performed on the overall multi-source data. Time-domain and frequency-domain features are extracted from the processed multi-source data to obtain a physiological feature set that integrates time-domain and frequency-domain features; The stimulation parameters contained in the multi-source data are standardized and encoded with the physiological feature set; The standardized and encoded stimulus parameters are fused with the physiological feature set to form a multidimensional feature vector, and the model training dataset is constructed based on the multidimensional feature vector.

3. The method according to claim 2, characterized in that, The intelligent evaluation model that integrates temporal feature mining and dual-task prediction functions includes a temporal feature extraction module and a dual-task classification module, wherein... The temporal feature extraction module is constructed based on a transduced long short-term memory network and a spatial attention mechanism. It is used to perform temporal modeling on the input features and output deep temporal features with weights. The dual-task classification module is constructed based on a hidden Markov model and combined with a first-order differential error adjustment mechanism. It is used to predict the neural recruitment efficiency level and subjective comfort level according to the deep temporal features and to dynamically correct the prediction results.

4. The method according to claim 3, characterized in that, The intelligent evaluation model is trained in stages based on the training dataset, including at least the following stages: In the first training phase, the trainable parameters of the temporal feature extraction module are frozen, and the parameters of the dual-task classification module are trained separately with the goal of maximizing the joint probability of the observed sequence and the real label. In the second training phase, the trainable parameters of the temporal feature extraction module are unfrozen, and the parameters of the temporal feature extraction module and the dual-task classification module are jointly optimized with the weighted sum of the reconstruction loss of the temporal feature extraction module and the classification loss of the dual-task classification module as the objective.

5. The method according to claim 4, characterized in that, The phased training process of the intelligent evaluation model also includes: The classification loss of the dual-task classification module is configured with a class weighting mechanism, which configures class weights based on the differences in class sample distribution, so as to enhance the model's attention to and recognition accuracy of a few key classes; An early stopping strategy is adopted, and a performance evaluation index is set in the strategy. Training is terminated when the evaluation index fails to improve for several consecutive iterations.

6. The method according to claim 1, characterized in that, Based on the joint prediction capability of the aforementioned intelligent evaluation model, the elite-based butterfly optimization algorithm is used to automatically optimize the key hyperparameters of the model, including: The key hyperparameter combinations to be optimized in the intelligent evaluation model are encoded as search individuals in the optimization algorithm to form an initial population. The fitness of each individual is evaluated based on the joint predictive performance of the intelligent evaluation model. Based on the fitness, individuals with high fitness are selected from the initial population as elite individuals to form an elite subpopulation; The population is iteratively updated by combining a global search guided by the best individual in the elite subgroup with a local search guided by random interactions within the elite subgroup. When the preset optimization termination condition is met, the hyperparameter combination with the best output performance is taken as the optimization result.

7. The method according to claim 6, characterized in that, Based on the fitness score, individuals with high fitness are selected from the initial population as elite individuals to form an elite subpopulation, including: All individuals in the initial population are sorted by their fitness, wherein the fitness is determined based on the joint prediction error quantification of the intelligent evaluation model; Individuals with the highest fitness rankings are selected according to a preset ratio to form the elite subgroup.

8. The method according to any one of claims 6 or 7, characterized in that, The population is iteratively updated by combining a global search guided by the best individual in the elite subgroup and a local search guided by random interactions within the elite subgroup, including: Assign a global or local search strategy to each individual in the population based on a preset switching probability; The global search causes the current individual to move to the location of the individual with the best fitness in the elite subgroup; The local search allows the current individual to be updated by perturbing the position information of multiple randomly selected elite individuals within the elite subgroup.

9. The method according to claim 1, characterized in that, The process, constrained by the dynamic constancy of a preset target stimulus energy, uses a trained and hyperparameter-optimized intelligent evaluation model to determine the optimal stimulus waveform and parameters from candidate stimulus waveforms and parameter combinations that achieve a comprehensive balance between neural recruitment efficiency and subjective comfort. This includes: Using the pre-set dynamic constancy of the target stimulus energy as a constraint, a subset that meets the energy tolerance range is selected from candidate waveforms and parameter combinations; Based on the intelligent evaluation model, the neural recruitment efficiency and subjective comfort of the candidate combinations in the subset are jointly predicted, and a comprehensive score is calculated based on preset rules. Based on the comprehensive score, the final output stimulus waveform and parameters are determined from the subset.

10. A device for optimizing diaphragmatic electrical stimulation waveforms based on energy control, characterized in that, include: The data acquisition and preprocessing module is used to collect multi-source data reflecting the electrical stimulation process, preprocess the multi-source data, and construct a model training dataset based on the preprocessed multi-source data. The model building and training module is used to build an intelligent evaluation model that integrates temporal feature mining and dual-task prediction functions. The intelligent evaluation model is trained in stages according to the training dataset so that the model has the ability to jointly predict neural recruitment efficiency and subjective comfort for different stimulus waveforms and parameter combinations. The model parameter optimization module is used to automatically optimize the key hyperparameters of the model based on the joint prediction capability of the intelligent evaluation model using the elite-based butterfly optimization algorithm. The optimal stimulus waveform and parameter search module is used to determine the optimal stimulus waveform and parameters that achieve the best overall balance between neural recruitment efficiency and subjective comfort from candidate stimulus waveform and parameter combinations, based on a trained and hyperparameter-optimized intelligent evaluation model, with the preset dynamic constancy of target stimulus energy as a constraint.