A closed-loop non-invasive spinal cord electrical stimulation method and system based on electromyographic signal feedback

CN122874804APending Publication Date: 2026-10-09ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611392551.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-09
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0014]为克服现有非侵入式脊髓电刺激主要采用固定参数或人工调参、难以根据神经肌肉状态动态调整刺激强度的问题,本发明提出一种基于肌电信号反馈的闭环非侵入式脊髓电刺激方法和系统

Benefits of technology

1、将连续肌电反馈直接引入非侵入式脊髓电刺激参数更新过程,使刺激由预先固定幅值转变为依据神经肌肉状态逐窗动态调节,能够在目标肌群激活不足时提供刺激补偿,在目标肌群达到目标范围后保持或降低刺激。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122874804A_ABST
    Figure CN122874804A_ABST
Patent Text Reader

Abstract

The application discloses a closed-loop non-invasive spinal cord electrical stimulation method and system based on electromyographic signal feedback, and belongs to the technical field of neural regulation and rehabilitation engineering. The method collects electromyographic signals of target muscle groups, constructs a closed-loop control strategy with the synergistic effect of main feedback muscles and safety constraint muscles through signal preprocessing, sliding window division, feature extraction and neuromuscular state recognition, dynamically adjusts the stimulation amplitude according to the electromyographic feedback, and controls the stimulation output in combination with safety supervision, refractory period and low-duty-cycle protection mechanism. The application also provides a closed-loop non-invasive spinal cord electrical stimulation system for realizing the above method, which comprises an electromyographic acquisition module, a signal processing module, a state recognition module, a closed-loop control module, a communication module and a stimulation output module. The application can dynamically adjust the stimulation parameters according to the neuromuscular state, and improve the adaptability and safety of non-invasive spinal cord electrical stimulation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of neuromodulation, rehabilitation engineering, biomedical signal processing, and medical electronic device control, and particularly to a method for generating control parameters and a closed-loop control system for a non-invasive spinal cord stimulation device based on electromyographic (EMG) signal feedback. The method uses EMG signals related to the target motor function as physiological feedback. Through EMG signal preprocessing, sliding windowing, time-domain and frequency-domain feature construction, neuromuscular state-assisted identification, master feedback control, safety constraints, fatigue monitoring, and stimulation parameter mapping, stimulation amplitude adjustment commands are generated within a continuous control time window. These commands are then used to drive the non-invasive spinal cord stimulation device to output a biphasic pulse current corresponding to the adjustment commands via a communication interface.

[0002] This invention further relates to a closed-loop control structure that coordinates a "main feedback muscle and a safety constraint muscle". In one exemplary embodiment, the electromyographic activity of the gastrocnemius muscle (GS) serves as the main feedback reflecting the functional state of the target extensor muscle and the need for stimulus compensation. The electromyographic activity of the tibialis anterior muscle (TA), the relative activation relationship between TA and GS, and fatigue indicators serve as safety constraints. Combined with the auxiliary discrimination probability of spinal cord injury-related states, the stimulation is dynamically switched between off, on, up, hold, and down.

[0003] This invention also relates to the interface implementation between the closed-loop control algorithm and the electrical stimulation hardware, including a host computer control program, virtual serial communication, stimulation level mapping, electrical stimulation device control unit, stimulation output module, current feedback unit, and hardware-in-the-loop verification process. It can be used to study the complete technical link of closed-loop non-invasive spinal cord electrical stimulation from physiological signal input to actual stimulation waveform output. Background Technology

[0004] Spinal cord injury (SCI) is a serious type of central nervous system injury, which can affect sensory, motor, and autonomic nervous functions to varying degrees. Following SCI, the conduction of neural pathways above and below the injured segment is disrupted, and the recovery of motor function is influenced by multiple factors, including damage to neural tissue structure, reduced excitability of residual neural circuits, and secondary injuries. How to utilize residual neural pathways and improve the plasticity and controllability of neural networks is an important issue in SCI rehabilitation and neuroengineering research.

[0005] Spinal cord stimulation (SCS) modulates the excitability of spinal cord neural networks by applying electrical pulses to relevant areas of the spinal cord and provides external stimulation input to residual neural pathways. Traditional epidural spinal cord stimulation requires surgical implantation of electrodes. Although the stimulation site is relatively direct, it presents problems such as implantation trauma, infection, electrode displacement, and subsequent maintenance. Percutaneous spinal cord stimulation or other non-invasive spinal cord stimulation methods do not require implantation of stimulation electrodes. They are repeatable, easy to adjust parameters, and flexible in research applications, thus gradually becoming an important technical approach for neuromodulation research on spinal cord injury.

[0006] In practical research and rehabilitation training, existing non-invasive spinal cord stimulation systems typically require the operator to pre-set the stimulation amplitude, frequency, pulse width, and duration. While some systems allow manual parameter adjustments, their basic operation remains open-loop or semi-open-loop control, meaning the stimulation parameters cannot be automatically updated based on the subject's neuromuscular activity. The required stimulation intensity may vary significantly for different individuals, degrees of injury, muscle states, and stages of movement. Fixing parameters can easily lead to insufficient stimulation, excessive stimulation, or continued stimulation even after the target muscle activation level has been reached.

[0007] In the modulation of motor function related to spinal cord injury, output based solely on a preset stimulation program may overlook the relationship between flexor and extensor muscles. For example, increasing the stimulation amplitude may help enhance output when the target extensor muscle is underactivated, but if the muscles opposite to its motor function are simultaneously overactivated, or if there is significant co-activation of flexor and extensor muscles, continuously increasing the stimulation intensity may worsen muscle coordination. On the other hand, prolonged continuous stimulation may be accompanied by muscle fatigue. If the controller only judges the stimulation demand based on the instantaneous amplitude, it may continue to increase the intensity even when fatigue has already significantly increased.

[0008] Electromyography (EMG) signals originate directly from muscle electrical activity and can reflect muscle activation intensity, local motor output, and a certain degree of neuromuscular functional state. Time-domain indices such as root mean square (RMS), mean absolute value, and integral EMG in EMG signals can describe muscle activation levels, while frequency-domain indices such as median frequency and mean frequency can be used to describe spectral distribution and fatigue-related changes. Therefore, introducing EMG signals into non-invasive spinal cord stimulation systems can provide more direct physiological feedback for the dynamic adjustment of stimulation parameters.

[0009] However, electromyographic (EMG) signals are non-stationary and susceptible to DC offset, power frequency interference, motion artifacts, local abnormal spikes, and recording channel fluctuations. Using the raw EMG waveform directly or relying solely on a single threshold for stimulation decisions can expose the controller to local noise, leading to false triggering, continuous ups and downs in stimulation levels, or frequent jumps in stimulation levels. Closed-loop EMG stimulation systems must simultaneously address issues related to signal quality, time window selection, feature construction, state recognition, control rules, and safety protection.

[0010] For neuromuscular state recognition, adjacent time intervals in continuous electromyography (EMG) data often exhibit strong correlations. If the training and test sets are randomly partitioned at the window level, different adjacent windows from the same original recording file may appear simultaneously in both sets, leading to an overestimation of model performance. Therefore, when using machine learning models to provide state-aided judgments for closed-loop stimuli, a file-level partitioning strategy that minimizes data leakage is needed. Furthermore, the window-level model output should be further aggregated or used as auxiliary probabilities, rather than allowing the classification label of a single window to directly determine the stimulus output.

[0011] For stimulus control strategies, a simple binary logic of "stimulation upon reaching a threshold" is insufficient to balance response speed, stability, and safety. A more suitable closed-loop control approach is to determine the stimulus requirement based on the target muscle activation level, and then modify the main feedback through antagonist muscle activation, muscle group relative relationships, fatigue state, and state recognition probability. This allows the stimulus amplitude to be gradually adjusted between multiple discrete levels, and to be shut down promptly when a high-risk state occurs.

[0012] Furthermore, obtaining stimulus decisions from the software does not necessarily mean that the closed-loop system has actual execution capability. The closed-loop stimulation system also needs to convert the control algorithm output into parameters that the stimulation device can recognize, and send them to the stimulation device via a serial port or other communication interface. The device's internal control unit and stimulation output module then generate actual pulses. Without interface verification between the software control algorithm and the hardware output, it is impossible to confirm the feasibility of the complete chain of "electromyographic state change - algorithm decision - amplitude update - hardware output".

[0013] Therefore, there is a need for a closed-loop non-invasive spinal cord stimulation method and system that can organically combine electromyographic signal preprocessing, window feature construction, neuromuscular state-assisted identification, master feedback regulation, safety constraints, fatigue monitoring, stimulation level updates, communication interfaces, and stimulation hardware execution. This would enable the stimulation output to change dynamically according to continuous electromyographic feedback, while reducing unnecessary continuous stimulation and frequent level changes through mechanisms such as protection gates, refractory periods, and low duty cycles. Summary of the Invention

[0014] To overcome the limitations of existing non-invasive spinal cord stimulation methods, which primarily rely on fixed parameters or manual adjustment and struggle to dynamically adjust stimulation intensity based on neuromuscular states, this invention proposes a closed-loop non-invasive spinal cord stimulation method and system based on electromyographic signal feedback. This invention integrates electromyographic signal processing, state recognition, master feedback control, safety constraints, and hardware execution into a continuous closed loop. Within each control time window, feedback variables are recalculated and the stimulation level is updated, enabling the stimulation amplitude to dynamically change with variations in muscle state.

[0015] The core idea of ​​this invention is as follows: A muscle pathway related to the target motor function and capable of stably reflecting the neuromuscular state is selected as the main feedback, while another related muscle pathway is selected as the safety constraint. The activation level of the main feedback muscle is used to determine the stimulus compensation requirement, while the activation of the safety constraint muscle, the relative activation relationship of muscle groups, and fatigue indicators are used to limit abnormal or excessive stimulation. Simultaneously, the output of the neuromuscular state recognition model is used as auxiliary information, rather than allowing it to independently determine the stimulus. Finally, the comprehensive control quantity is converted into discrete stimulation levels and driven by a non-invasive spinal cord stimulation device through a communication interface. The safety constraint muscle and the main feedback muscle have an antagonistic relationship, or their abnormal co-activation can characterize the incoordination of the target motor function. The main feedback forms a regulatory trend towards the target activation range, while the safety constraint and fatigue information only participate in control along the direction of inhibiting stimulus output.

[0016] The present invention proposes a method for generating control parameters for a non-invasive spinal cord stimulation device, comprising the following steps: S1, Acquire electromyographic feedback data. Collect electromyographic signals from at least two muscle pathways related to the target motor function, designating one muscle pathway as the primary feedback pathway and the other as the safety constraint pathway. In a preferred embodiment, the primary feedback pathway is the gastrocnemius muscle (GS), and the safety constraint pathway is the tibialis anterior muscle (TA). The safety constraint pathway and the primary feedback pathway are antagonistic, or abnormal activation of both the safety constraint pathway and the primary feedback pathway can characterize the incoordination of the target motor function.

[0017] S2 performs quality control and preprocessing on electromyographic signals. It completes one or more of the following processing steps: target channel extraction, bipolar differential, DC offset removal, bandpass filtering, power frequency interference suppression, local abnormal peak repair, and wavelet soft threshold candidate denoising. It also performs feature fidelity judgment on the processing results.

[0018] S3, divide the continuous electromyography (EMG) signal into a sliding window. Set the window length and window step size according to the time resolution required for state recognition and closed-loop control, so that the continuous EMG signal is converted into continuous window-level samples; in one closed-loop control implementation, the window length is 200ms and the step size is 50ms.

[0019] S4. Construct window-level electromyographic features. Calculate the time-domain features, frequency-domain features, and derived variables related to muscle group relationships for the main feedback muscle and the safety constraint muscle, respectively. These features include one or more of the following: root mean square (RMS), mean absolute value (MAV), variance, waveform length, number of zero-crossing points, number of slope sign changes, integrated electromyographic value (iEMG), mean frequency (MNF), median frequency (MDF), total power, and power percentages across multiple frequency bands.

[0020] S5, Establish or invoke the neuromuscular state recognition model. Based on electromyography (EMG) files with different neuromuscular state labels, establish a state recognition model, outputting state categories and / or state probabilities for window-level features; preferably, a fixed file-level partition is used to separate training and testing files, ensuring that windows from the same original file only enter the same dataset.

[0021] S6. Construct closed-loop control variables. Construct relative activation values ​​based on the current window RMS values ​​of the primary feedback muscle and the safety constraint muscle and their respective baseline values. Construct relative activation ratios of muscle groups based on the amplitude relationship between the two muscle pathways. Construct fatigue indices based on the change in the median frequency of the primary feedback muscle relative to the baseline. Calculate the deviation and rate of change of the deviation of the primary feedback muscle relative to the target activation interval.

[0022] S7 executes closed-loop stimulus amplitude decision-making. The primary regulatory trend is formed by the degree of insufficient or excessive activation of the main feedback muscle. The state-assisted probability is used as an enhancing term, while the activation of safety constraint muscles, the relative relationship between muscle groups, co-activation, and fatigue state are used as inhibiting terms. A comprehensive control quantity is generated, and based on the comprehensive control quantity and the protection gate conditions, the following actions are output: close, start, increase, maintain, or decrease the stimulation level. The state-assisted probability only participates in ordinary control and cannot independently trigger the stimulus level to update from zero to a non-zero level, nor can it cover safety constraints.

[0023] S8 executes stimulus level mapping and safety execution. It updates the stimulus action to a finite set of discrete stimulus levels and sets one or more of the following: hard safety layer, soft safety layer, probability-assisted initiation, refractory period, and low duty cycle protection. When a high-risk condition is triggered, the stimulus is preferentially shut down; when a mild risk occurs, further escalation is restricted or the continuous stimulation time is shortened. When the normal control action is to escalate the stimulus level and the relative activation relationship of the muscle group or fatigue index reaches the warning threshold but not the hard safety threshold, the escalation action is corrected to a hold action. When the hard safety threshold is reached, a shut-down action overrides the normal control action, and the stimulus level is set to zero. Downgrading or shut-down actions generated by normal control are not changed to hold or escalation due to safety constraints; hard safety shut-down is not restricted by progressive downgrading rules.

[0024] S9: The stimulation level is mapped to the actual stimulation parameters and sent to the non-invasive spinal cord electrical stimulation device. The stimulation device outputs an electrical stimulation waveform according to the received parameters; then, it acquires the electromyographic data for the next control time window and repeats steps S3 to S9, so that changes in electromyographic state can be continuously fed back into the stimulation parameter update process.

[0025] In a preferred embodiment of the present invention, the selection of the primary feedback muscle in S1 is not fixed to GS, but can be determined based on the target motor task, the state discrimination ability of candidate muscles, and the stability of electromyography recording. State recognition models are established for multiple candidate muscles, and the stability of different muscle pathways is compared using window-level F1 scores, balance accuracy, MCC, ROC-AUC, and full-file-level majority voting results. The muscle with the best overall recognition performance is selected as the primary feedback muscle, and another muscle that reflects antagonistic movement, abnormal co-activation, or safety risks is selected as the safety constraint muscle.

[0026] In one implementation of animal experimental data, after establishing SCI / intact state recognition models for the gastrocnemius muscle (GS) and tibialis anterior muscle (TA), the GS pathway outperformed the TA pathway at both the window and file levels. Therefore, GS was selected as the closed-loop stimulus master feedback, while TA served as a safety constraint and auxiliary reference. The above values ​​are merely an implementation method for verifying the master feedback selection logic and do not constitute a limitation on other data or other muscle pathways.

[0027] In a preferred embodiment of the present invention, the electromyography (EMG) signal preprocessing in S2 includes differential filtering and bandpass filtering. Taking bipolar EMG recording as an example, the two recording electrode channels of the target muscle are read from the original multi-channel signal and differentially processed to reduce common-mode interference and the influence of far-field signals. For the original high-sampling-rate EMG data, a bandpass filter in the range of 30Hz to 1000Hz can be used first to retain the main EMG frequency components; in the subsequent offline recognition stage, a frequency band of 20Hz to 450Hz can be further used according to the feature extraction requirements. The above frequency bands can be adjusted according to the sampling rate and application scenario.

[0028] In a preferred embodiment of the present invention, step S2 further employs a joint denoising strategy. First, DC offset is removed using the median or mean; then, a 50Hz notch filter or other power frequency suppression method is used to reduce power supply interference; for local instantaneous spikes, local anomaly detection methods such as Hampel-MAD are used to identify anomaly points based on the median and median absolute deviation within the local window, and repair them using interpolation of adjacent normal sampling points or other robust methods.

[0029] In a further preferred embodiment of the present invention, wavelet soft thresholding candidate denoising can be performed after local anomaly repair. Since an excessively strong wavelet threshold may weaken the true high-frequency structure of electromyography (EMG), the present invention does not unconditionally use the wavelet output as the final result, but instead sets a feature fidelity judgment: comparing the changes in indicators such as RMS, main frequency band power, and MDF between the wavelet candidate result and the Hampel repair result. When the changes are within the allowable range, the wavelet candidate result is adopted; when the changes exceed the set range, the Hampel repair result is used, thereby achieving a balance between suppressing subtle noise and maintaining the main structure of EMG.

[0030] In a preferred embodiment of the invention, step S3 uses a sliding time window to convert continuous electromyographic signals into window-level samples. For offline state recognition, a short window can be used to improve temporal resolution; for closed-loop control, a longer window can be used to give RMS, frequency domain features, and muscle group relationship indicators more stable statistical significance. In a preferred embodiment, the closed-loop window length is 200 ms, the window step size is 50 ms, adjacent windows overlap, and the controller receives new feedback every 50 ms and decides whether to update the stimulation level.

[0031] In a preferred embodiment of the present invention, let the root mean square values ​​of the GS and TA electromyographic signals in the k-th control window be respectively... and Their resting baselines are denoted as follows: and , A minimal constant is set to prevent the denominator from being zero. The relative activation levels of GS and TA can then be expressed as follows:

[0032]

[0033] By using relative activation values ​​instead of directly using absolute electromyographic amplitudes, the influence of different recording files, electrode contact states, and individual baseline amplitude differences on control variables can be reduced to some extent. The baseline can be calculated from the resting phase, the pre-stimulation phase, or a preset reference phase, and the baseline can be updated using a fixed baseline or a slowly updating baseline. The relative activation values ​​and the muscle group relative activation relationships formed by the ratio of safety constraint relative activation values ​​to main feedback relative activation values ​​are dimensionless quantities normalized to their respective baselines.

[0034] To describe the relative relationship between the primary feedback muscle and the safety restraint muscle, the TA / GS ratio is further defined as...

[0035] when A higher level indicates a higher degree of activation of the safety restraint muscles relative to the main feedback muscles, which may reflect uncoordinated activation between flexor and extensor muscles or excessive involvement of antagonist muscles. Instead of shutting down stimuli directly on their own, they are combined with the relative activation level of the target stimuli (TA), co-activation judgment, and other safety conditions to form a safety constraint.

[0036] In terms of fatigue monitoring, this invention can use the percentage decrease in the median frequency of the main feedback muscle relative to the baseline as a window-level fatigue indicator. Let... Let MDF(k) be the baseline median frequency and MDF(k) be the median frequency of the current control time window. Then the fatigue index fatigue(k) can be expressed as:

[0037] When the median frequency decreases relative to the baseline, An increase in the level indicates an increased risk of fatigue. The fatigue index can be set with multiple thresholds: near a lower threshold, it only restricts further increases in intensity or reduces the duration of continuous stimulation; when a higher threshold is reached, it triggers hard safety protection, prioritizing reducing the stimulation level to zero or entering a rest state.

[0038] In a preferred embodiment of the present invention, the state recognition model in S5 takes window-level features as input and outputs SCI-related state probabilities. Or other probabilities related to the target neuromuscular state. During training, the training and test sets are divided according to the original files, and windows within the same original file do not cross sets to reduce data leakage caused by high correlation between adjacent time windows. The classification model can be a model selected by the AutoGluon automatic machine learning framework, or it can be a gradient boosting tree, random forest, support vector machine, neural network, or other classification methods that can output class probabilities.

[0039] In this invention, the state recognition result is auxiliary information, not the sole basis for control. Even If the main feedback muscle is already within the target range or safety and fatigue constraints have been triggered, the controller can maintain, downshift, or shut down; conversely, if the main feedback muscle shows short-term insufficient activation, but... If the value is low, the controller can suppress activation, thereby reducing the likelihood of false stimulation caused by fluctuations in a single electromyographic window.

[0040] In a preferred embodiment of the present invention, a target activation region is set for the main feedback muscle. Define the main feedback deviation E(k) as: when When, E(k) = ;when When, E(k) = 0; when When, E(k) = .

[0041] Therefore, when E(k) > 0, it indicates insufficient GS activation, and the controller tends to initiate or upshift; when E(k) = 0, it indicates that GS is within the target range, and the controller tends to maintain the current gear; when E(k) < 0, it indicates that GS activation is too high, and the controller tends to downshift or suppress stimulation. The deviation change rate is defined as ΔE(k) = E(k) - E(k-1), which describes whether the main feedback state is improving or deviating further from the target range between adjacent control steps.

[0042] In a preferred embodiment of the present invention, the main feedback deviation, the deviation change rate, the SCI state auxiliary probability, the TA safety constraint term, and the fatigue constraint term constitute the comprehensive control quantity Y(k):

[0043] In the formula, For the reason , Safety constraints constructed from flexor and extensor co-activation states or combinations thereof. For fatigue constraints, to The weights are used to change the relative role of various feedback information in the overall control quantity. Their specific values ​​can be tuned through near real-time playback results, dynamic simulation, or actual experiments.

[0044] The stimulus amplitude is updated using discrete levels. Let L(k) be the index of the current stimulus level. The threshold for upgrading, To lower the threshold, the following update method can be used if the hard security protection is not triggered: If And if the refractory period counter is 0, then L(k+1) = min[L(k)+1, L_max]; if Then L(k+1) = L(k); if Then L(k+1) = max[L(k)-1, 0].

[0045] When a hard safety condition is triggered, L(k+1) is preferentially set to 0, and the normal upshift / downshift logic is not executed. Since the stimulus levels are represented by a finite number of discrete integers, the controller can change the amplitude step by step at the window boundaries, avoiding the generation of arbitrary continuous values ​​in each control step that could lead to communication and hardware instability.

[0046] In a preferred embodiment, the stimulus level index L(k) takes values ​​of 0, 1, 2, 3, and 4, which correspond to 0.0 mA, 0.5 mA, 1.0 mA, 1.5 mA, and 2.0 mA, respectively. The actual stimulus amplitude A(k) can be expressed as: A(k) = ,in ∈ {0, 0.5, 1.0, 1.5, 2.0} mA.

[0047] The levels and amplitudes mentioned above are for illustrative purposes only. Actual systems can have more or fewer levels depending on the output range of the stimulation device, the tolerance range of the test subject, the experimental purpose, and safety requirements. Alternatively, other amplitude sequences can be used while maintaining a discrete control structure.

[0048] In a preferred embodiment of the invention, the safety monitoring employs a layered structure, including a hard safety layer and a soft safety layer. The hard safety layer is used to handle high-risk conditions, such as significantly excessive TA activation. If the high-risk threshold is exceeded, flexor and extensor muscle co-activation reaches the mandatory protection condition, fatigue indicators significantly increase, or communication / equipment status is abnormal, the controller will preferentially shut down the stimulation and enter the protection state once the hard safety condition is met. The soft safety layer is used to handle mild risks that have not yet reached the mandatory shutdown condition, such as gradually increasing TA activation or fatigue indicators approaching the warning zone. In this case, further escalation can be prohibited, continuous stimulation time can be shortened, or escalation can be allowed.

[0049] The role of TA (Traction Therapy) safety constraints is to supplement the deficiencies of GS (Gross Sense) main feedback. GS primarily reflects whether there is insufficient activation of the target extensor muscle. However, if TA is also significantly activated at this time, or if the TA / GS ratio is high, it indicates that there may be uncoordinated activation between the flexor and extensor muscles, and further increasing the stimulation may be detrimental to stable control. Therefore, the controller can use the TA safety factor as a negative correction, so that the same GS deficiency state receives a more conservative stimulation action when the TA risk is high. In a preferred control rule, when the normal control action is to increase the level and the TA / GS ratio or fatigue index reaches the warning threshold but not the hard safety threshold, the increase action is uniquely corrected to hold; when the hard safety threshold is reached, the stimulation level is set to zero.

[0050] In a preferred embodiment of the present invention, a probability-assisted activation mechanism is provided. When the current stimulation level is 0, Reaching the preset startup probability threshold When the value is below the upper limit of the allowed auxiliary start, and neither the TA safety constraint nor the fatigue constraint is triggered, the controller is allowed to move from the off position to the lowest non-zero position. This mechanism is used to improve the problem of insufficient start-up of some SCI state samples when relying solely on the GS amplitude, while still limiting false start-ups through state probability and safety gates.

[0051] In a preferred embodiment of the invention, a refractory period mechanism is provided. After activation, upshifting, downshifting, or protection shutdown, the refractory period counter R(k) is set to a preset positive integer. Within the control time window where R(k) > 0, the controller allows holding, downshifting, and shutdown, but restricts upshifting again; the counter decrements with each control step. This mechanism reduces frequent jumps in stimulus levels between adjacent windows, improving the temporal continuity of the control output.

[0052] In a preferred embodiment of the present invention, a low duty cycle protection mechanism is provided. The number of control time windows for continuously outputting non-zero stimuli is recorded. ,when Reaching the maximum allowed number of consecutive stimulation windows When the system enters a resting state, L(k) is forced to 0 within several control windows; after the rest period, closed-loop restart is allowed again. Thus, even if continuous feedback satisfies the stimulus conditions for a long time, the system can periodically reduce the stimulus duty cycle, reducing prolonged continuous output. The state-assisted probability must not trigger the transition from zero to non-zero levels independently; the resting state, safety constraints, and fatigue constraints have higher execution priority than probability-assisted startup.

[0053] This invention also provides a closed-loop non-invasive spinal cord stimulation system based on electromyographic signal feedback, comprising an electromyographic signal acquisition module, a signal preprocessing module, a sliding window module, a window feature calculation module, a state recognition module, a control variable construction module, a closed-loop control module, a safety monitoring module, a stimulation level mapping module, a communication interface module, and a non-invasive spinal cord stimulation module, with the following connection relationships: The communication interface module provides the command transmission status to the safety monitoring module to identify communication anomalies; the current feedback unit provides the stimulation output status to the safety monitoring module to identify stimulation device anomalies. When a communication anomaly or stimulation device anomaly is identified, the safety monitoring module sets the stimulation level to zero.

[0054] The electromyography (EMG) signal acquisition module is used to acquire continuous EMG signals from at least the main feedback muscle and the safety restraint muscle, and input the EMG data into the signal preprocessing module. The signal preprocessing module performs channel extraction, bipolar differential spectroscopy, DC removal, bandpass filtering, power frequency interference suppression, abnormal peak repair, and candidate wavelet denoising, and outputs an EMG sequence that meets quality requirements to the sliding window module. The sliding window module divides the continuous EMG sequence into time-ordered window data according to a set window length and step size. The window feature calculation module calculates time-domain features, frequency-domain features, and required derived indices from each window, and forms standardized feature vectors for the main feedback muscle and the safety restraint muscle respectively. The state recognition module calls a pre-trained state recognition model to output the neuromuscular state category and / or SCI-related state auxiliary probability for the current window. The control variable construction module calculates... , , , The control module comprises one or more of E(k) and ΔE(k); the closed-loop control module is used to form a comprehensive control quantity based on the main feedback adjustment quantity, state auxiliary probability and safety constraint term, and output the actions of closing, starting, upgrading, holding or downgrading; the safety supervision module is used to execute TA safety constraint, fatigue supervision, protection shutdown, refractory period and low duty cycle protection after or in parallel with the ordinary control action, so that the safety action has a higher execution priority than the ordinary upgrading action; the stimulation level mapping module is used to update the control action to discrete levels and convert the levels into amplitude parameters that the electrical stimulation device can execute; the communication interface module is used to send the amplitude parameters to the stimulation device via USB to serial port or other wired / wireless communication methods; the non-invasive spinal cord electrical stimulation module includes a control unit, a stimulation output module, a current feedback unit, an output lead wire and a body surface electrode interface, and is used to output a pulse current of corresponding intensity according to the received parameters. In one hardware implementation, the host computer program establishes a virtual COM port connection with the electrostimulation device via a USB-to-serial adapter. The serial port parameters are 115200 baud rate, 8 data bits, 1 stop bit, and no parity. After receiving a new stimulation level in each control time window, the host computer converts the target amplitude into executable control fields such as device channel number, parameter address, and amplitude data, and sends them to the electrostimulation device. Upon receiving these fields, the device control unit controls the stimulation output module to generate a corresponding current pulse.

[0055] In one stimulus output implementation, a single-channel CH1 output is used to generate a symmetrical biphasic rectangular wave with a stimulation frequency of 50 Hz and a pulse width of 5 ms for both the positive and negative phases. During the closed-loop process, the frequency, pulse width, and waveform remain constant, with only the stimulation current amplitude dynamically changed. By limiting the main control degree of freedom to amplitude, control coupling caused by simultaneous changes in multiple stimulation parameters can be reduced, and the correspondence between the algorithm output and the hardware waveform can be easily verified.

[0056] Compared with the prior art, the present invention has the following beneficial effects: 1. By directly introducing continuous electromyographic feedback into the non-invasive spinal cord stimulation parameter update process, the stimulation is transformed from a pre-fixed amplitude to a window-by-window dynamic adjustment based on the neuromuscular state. This can provide stimulation compensation when the target muscle group is under-activated, and maintain or reduce stimulation after the target muscle group has reached the target range.

[0057] 2. A control structure with division of labor between primary feedback muscles and safety constraint muscles is adopted. Primary feedback muscles such as GS reflect the stimulus demand, while safety constraint muscles such as TA and their relative activation relationship with primary feedback muscles limit uncoordinated activation, thus avoiding the controller focusing only on the amplitude of a single muscle.

[0058] 3. Incorporate RMS relative activation, TA / GS ratio, MDF fatigue index, state assist probability, and main feedback bias into closed-loop control to ensure that stimulus actions are determined by multiple sources of information, thereby reducing the possibility of false triggering caused by short-term fluctuations in a single threshold.

[0059] 4. A state recognition module is constructed using file-level training / test partitioning and window-level probabilistic assistance, so that the state recognition results can provide additional evidence for closed-loop control, while avoiding the complete replacement of interpretable feedback control rules by a single machine learning label.

[0060] 5. By adopting discrete stimulus levels and a step-by-step update method, the algorithm output can be directly mapped to hardware-executable parameters, reducing the impact of continuous arbitrary numerical adjustments on communication, equipment response, and control stability.

[0061] 6. Set up hard safety layer, soft safety layer, refractory period and low duty cycle protection to give safety shutdown a higher execution priority than normal upshift, and improve process stability by limiting continuous stimulation and frequent upshifts in adjacent windows.

[0062] 7. Construct a complete hardware-in-the-loop technology link from electromyography data input, state recognition, closed-loop decision-making, stimulation level mapping, serial communication to electrical stimulation device output. Attached Figure Description

[0063] By reading the detailed description of the preferred embodiments below, those skilled in the art will be able to further understand the structure, control process, and beneficial effects of the present invention. The accompanying drawings are used to illustrate embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In the drawings, modules that are the same or have similar functions may be represented by the same or similar reference numerals.

[0064] Figure 1 This is the overall process of electromyography signal acquisition and preprocessing in this invention; Figure 2 This is the overall process of offline electromyography signal analysis and stimulation decision-making in this invention; Figure 3 This is the training process for the electromyography state recognition model and the file-level state determination process in this invention; Figure 4 This is the overall framework for closed-loop stimulus amplitude control based on GS master feedback and TA safety constraints in this invention; Figure 5 This is a comparison of the closed-loop stimulation control process in the typical SCI state and the normal state in this invention; Figure 6 The results are Python dynamic simulations of the closed-loop stimulus control algorithm in this invention. Figure 7 This describes the working principle of the non-invasive spinal cord stimulation device used in this invention. Figure 8 The biphasic rectangular stimulation waveform and its main parameters used in this invention; Figure 9 This invention describes the control process of the closed-loop control scheme under typical SCI electromyographic signal input conditions and the biphasic rectangular wave stimulation output within the trigger interval. Detailed Implementation

[0065] To better understand the technical solution of this invention, the following describes in detail the electromyography (EMG) feedback data acquisition, signal preprocessing, neuromuscular state recognition, closed-loop control variable construction, stimulation amplitude decision-making, extended control strategy, dynamic simulation, and hardware output verification processes, following the technical flow corresponding to the invention's content. The following description is based on EMG data from animals with spinal cord injury and a programmable non-invasive spinal cord stimulation device, aiming to illustrate the complete closed-loop technical link of this invention from physiological signal input to stimulation command execution. The muscle pathway, window length, threshold, weight, stimulation level, communication method, and stimulation parameters can all be equivalently adjusted according to the target motor task, stimulation device capabilities, and safety requirements. The following technical flows are respectively combined with... Figures 1 to 9 Please provide an explanation.

[0066] It should be noted that the closed-loop control of this invention does not require the neuromuscular state recognition model to decide whether to stimulate alone. Instead, it uses the state recognition results as auxiliary information, which, together with the real-time activation level of the main feedback muscle, the activation state of the safety constraint muscle, the relative relationship of muscle groups, fatigue indicators, and protection logic, participate in the control. The stimulation amplitude output by the software is further converted into parameters that the electrical stimulation device can recognize and execute through the communication interface, thus forming a loop of "EMG acquisition - preprocessing - state and feature calculation - closed-loop decision - stimulation level mapping - hardware execution - next time window feedback".

[0067] S1, acquire electromyographic feedback data for closed-loop control and determine the main feedback path and safety constraint path.

[0068] S11, acquire electromyographic data of candidate muscles under different neuromuscular states.

[0069] In a preferred embodiment, the gastrocnemius (GS) and tibialis anterior (TA) muscles, which are related to hindlimb motor function, are selected as candidate electromyographic feedback pathways. GS is mainly involved in hindlimb extension-related movements, while TA is mainly involved in hindlimb flexion and foot dorsiflexion-related movements. Both can reflect hindlimb neuromuscular activity from different perspectives. Data used to establish the basis for state recognition and closed-loop control can be obtained from continuous electromyographic recordings of the spinal cord injury group (SCI) and the normal control group (intact). The SCI group is used to provide electromyographic characteristics under neuromuscular dysfunction, while the intent group is used to provide control characteristics under normal neuromuscular conditions.

[0070] Among the data sources used, the experimental subjects were rat hindlimb electromyography (EMG) signals. The SCI group was obtained through a spinal cord injury model, while the intent group did not undergo spinal cord injury treatment. This animal grouping was only used to obtain feedback data in different states and to verify the control method. The control structure of this invention is not limited to a specific animal species, nor is it limited to the requirement of first establishing an SCI model. In other applications, human surface EMG, intramuscular EMG, or other electrophysiological signals that can reflect the activity of the target muscle group can be used.

[0071] S12, electromyography recording electrodes are placed on the candidate muscle to form a bipolar recording channel.

[0072] Electromyography (EMG) recording employs a bipolar recording method. For each target muscle, a pair of recording electrodes are positioned at locations that reflect the local electrical activity of that muscle, along with a reference electrode and a ground electrode. The two recording electrodes are connected to the corresponding channels of the EMG acquisition system, and the EMG signal of the target muscle is obtained through differential recording. Using bipolar differential recording can reduce common-mode interference, far-field signals, and some motion artifacts, improving the discernibility of local muscle activity.

[0073] In one data acquisition method, raw electromyography (EMG) data is continuously recorded by the NeuroStudio acquisition system and saved as a multi-channel BTN file at a sampling rate of 30,000 Hz. After reading the file, the corresponding recording channels for GS and TA are extracted based on the electrode connection relationship. The TA signal is obtained by differential analysis of the corresponding two channels, and the GS signal is obtained by differential analysis of another pair of corresponding channels. The two differential signals are used as the basic inputs for subsequent preprocessing, feature extraction, state recognition, and closed-loop control, respectively.

[0074] S13, perform channel checks and validity assessments on the original records.

[0075] Before formally constructing the closed-loop variables, basic quality control is performed on the raw files, including checking recording duration, number of sampling points, amplitude range, baseline drift, suspected clipping, persistent power frequency contamination, and abnormal large spikes. Files with loose electrodes, prolonged channel saturation, insufficient effective recording duration, or severe artifact coverage of major signal segments can be marked as low-quality files and excluded from state recognition model training and closed-loop control parameter tuning. This step is to prevent the subsequent controller from misinterpreting acquisition faults as real neuromuscular state changes.

[0076] S14, compare the state discrimination ability of candidate muscles and determine the control role.

[0077] This invention does not pre-define that all applications must use a single fixed muscle as the main feedback pathway. Instead, it first establishes state recognition models for candidate muscles and compares their window-level and document-level stability. Evaluation may include F1 score, accuracy, balance accuracy, MCC, precision, recall, ROC-AUC, and the majority vote result for the complete document. The muscle with higher overall stability and the ability to consistently reflect the target motor output is configured as the main feedback pathway; another muscle that reflects antagonistic activity, aberrant co-activation, or stimulation risk is configured as the safety constraint pathway.

[0078] In the comparison results between the GS and TA pathways, the GS pathway showed better overall recognition performance than the TA pathway. Therefore, in subsequent closed-loop control, GS was set as the main feedback, and TA was set as a safety constraint and auxiliary reference. This comparison result is used to illustrate the pathway selection logic and does not constitute a limitation on the specific name of the main feedback muscle.

[0079] S2, as Figure 1 As shown, the electromyographic signals of GS and TA are preprocessed, jointly denoised, and windowed.

[0080] S21 completes the basic bandpass filtering and DC offset processing of the differential signal.

[0081] After channel extraction and differential processing, the raw multi-channel recordings undergo basic filtering on the GS and TA signals. In one preprocessing method, a fourth-order Butterworth bandpass filter (30Hz to 1000Hz) is used to preserve the main frequency components of the electromyography (EMG) signals, and a zero-phase filter is employed to reduce the impact of phase delay on the waveform structure. For the subsequent offline state recognition stage, a bandpass setting of 20Hz to 450Hz can be further used based on the feature analysis range, and mean-reduction processing is performed on each signal segment to eliminate residual DC offset.

[0082] The upper and lower limits of the filter are not fixed parameters that cannot be changed in this invention. The effective spectrum corresponding to different EMG acquisition methods, sampling rates, electrode types, and target muscle groups may be different. As long as the filter used can suppress low-frequency baseline drift and high-frequency non-target noise, while retaining the main EMG frequency bands required for subsequent RMS, MAV, MDF, MNF, and band power characteristics, it can be used as an equivalent preprocessing method.

[0083] S22 employs a joint denoising process consisting of Hampel anomaly spike repair and wavelet soft threshold candidate denoising.

[0084] Even after basic filtering, continuous electromyography (EMG) may still contain local abnormal spikes, slight power frequency residues, and high-frequency random disturbances. Therefore, the overall offset is first removed using the median or mean, and then power frequency pollution is reduced using a 50Hz notch filter or a suppression method corresponding to the local power frequency. For local transient anomalies, the Hampel-MAD method is used to calculate the median and median absolute deviation within a local window. Sampling points that significantly deviate from the local distribution are identified as anomalies and corrected using interpolation of adjacent normal points or other robust estimation methods.

[0085] Based on Hampel repair, wavelet soft-threshold candidate denoising results are further constructed. Considering that the electromyographic signal itself has a wide spectrum, excessive wavelet denoising may change the true electromyographic energy and spectral structure. Therefore, this invention sets a feature fidelity gate. The RMS, main frequency band power, and MDF of the Hampel repair result and the wavelet candidate result are calculated respectively to form the feature change ΔF. When the feature change does not exceed the allowable threshold T_F, the wavelet candidate result is accepted; when the feature change exceeds T_F, the wavelet candidate result is discarded and the process reverts to the Hampel repair result.

[0086] = When ΔF ≤ ; = When ΔF> .

[0087] Through the aforementioned combined strategy, Hampel processing primarily targets local abnormal spikes, wavelet soft thresholding mainly addresses residual subtle noise, and feature fidelity gates prevent over-smoothing. This approach improves the continuity of local waveforms while preserving the amplitude energy and main spectral distribution of the original electromyography (EMG), providing stable data for subsequent state recognition and closed-loop variable calculation.

[0088] S23 converts continuous electromyographic signals into time-sequential sliding window data.

[0089] For offline state recognition, short windows such as 25ms and 5ms step size can be used to improve the temporal resolution of local dynamic changes. For closed-loop amplitude control, a longer control window is used to make RMS, MDF, TA / GS ratio, and fatigue index have more stable statistical significance. In a near real-time playback and hardware interface testing embodiment of the present invention, the control window length is set to 200ms and the step size is set to 50ms, that is, adjacent windows overlap, and the system obtains a new set of feedback features every 50ms and determines whether the stimulus level needs to be updated.

[0090] Let the mean-removed discrete electromyography sequence be x(n), the window length be L, and the step size be S. Then the k-th window can be written as: Within the same control step, windows at the corresponding time positions of GS and TA are extracted to ensure that the two electromyographic features are time-aligned. This synchronization window serves as a common time reference for main feedback, safety constraints, and state recognition.

[0091] S24, Perform a window-level quality check on each sliding window.

[0092] Window-level quality checks include the proportion of effective sampling points, extreme amplitudes, residual DC offset, number of abnormal spikes, and suspected clipping conditions. If the quality of a single window does not meet the requirements, it can be handled by maintaining the previous stimulation level, prohibiting further increases, or directly entering a safe hold state, rather than directly using the abnormal amplitude of that window for stimulation escalation. If multiple consecutive windows fail to meet the quality requirements, it is preferable to turn off the stimulation and wait for the signal to recover, to ensure that stimulation control is not driven by ineffective electromyography. In this embodiment, a window that meets the above window-level quality check requirements is defined as a valid window; the calculation of the rate of change between adjacent windows uses adjacent valid windows.

[0093] S3, as Figure 2 and Figure 3 As shown, window-level electromyographic features are constructed and an SCI / intact state-assisted recognition model is established.

[0094] S31 extracts time-domain, frequency-domain, and frequency band energy features from each GS and TA window.

[0095] Temporal features are used to describe the amplitude level, waveform complexity, and activity intensity of local electromyography (EMG) windows, and may include the root mean square (RMS), mean absolute value (MAV), variance, waveform length, number of zero-crossing points, number of slope sign changes, and integrated electromyography (iEMG). Frequency domain features are calculated after obtaining the power spectrum through fast Fourier transform, and may include the mean frequency (MNF), median frequency (MDF), peak frequency, total power, and the power proportions of frequency bands such as 20-80Hz, 80-150Hz, 150-250Hz, and 250-450Hz.

[0096] During the model comparison phase, schemes using only time-domain features and schemes combining time and frequency domain features can be constructed separately. Independent models can be built for TA and GS respectively, resulting in candidate schemes such as TA time-domain, TA time-frequency joint, GS time-domain, and GS time-frequency joint. By using a unified data partitioning and evaluation method, different schemes can be compared to avoid unfair comparisons caused by different model training processes.

[0097] S32 uses a fixed partitioning at the original file level to establish the training and test sets.

[0098] Since adjacent sliding windows within the same original electromyography (EMG) file exhibit strong correlation, this invention first divides the files into training and testing files at the file level, and then uniformly assigns all windows from the same file to the corresponding set. Preferably, stratified sampling is performed according to group and muscle type; for example, approximately 80% of the files are designated as training files and approximately 20% as testing files, with a fixed random seed. This strategy can reduce the performance overestimation caused by adjacent windows from the same file appearing simultaneously in both the training and testing sets.

[0099] S33 trains a window-level classification model and outputs the state category and SCI auxiliary probability.

[0100] During the training phase, the AutoGluon automatic machine learning framework can be used to compare various candidate classifiers and select the best-performing model based on metrics such as the F1 score. Alternatively, gradient boosting trees, random forests, support vector machines, neural networks, or other models capable of outputting classification probabilities can be used directly. For the k-th window, the model outputs the SCI class probability. And the corresponding window category. It is used to describe the similarity between the current electromyographic characteristics and the SCI state characteristics, and serves as an auxiliary regulatory quantity in the closed-loop phase.

[0101] S34 summarizes the window-level output into file-level statistics and verifies pathway stability.

[0102] For a complete test file, the file-level predicted class is obtained by majority voting for all window categories, and the average probability and percentage of SCI windows are calculated. Window-level metrics reflect the model's ability to distinguish local EMG segments, while file-level results reflect the model's stability across the entire recording. Through two-level evaluation, GS is determined to be more suitable as the main feedback than TA, avoiding the direct selection of feedback pathways based on a single window or a single metric.

[0103] S35 restricts the state recognition results to auxiliary decision-making information during the closed-loop operation phase.

[0104] Closed-loop control does not directly use the simple logic of "SCI=1 means stimulation, intent=0 means no stimulation". When When the GS is high but already within the target activation range, or when the TA safety constraint or fatigue constraint has been triggered, the controller can still maintain, downgrade, or shut down; when the GS is insufficiently activated for a short period of time... At lower levels, the controller can suppress initiation. This reduces the direct impact of misclassification of a single window or short-term electromyographic fluctuations on the final stimulus action.

[0105] S4, as Figure 4 As shown, closed-loop control variables are constructed based on GS main feedback, TA safety constraints, and fatigue state.

[0106] S41, construct the relative activation levels of GS and TA.

[0107] Let the root mean square values ​​of GS and TA for the k-th control window be respectively and The baselines obtained from the resting phase, the pre-stimulation phase, or the preset reference phase are respectively and ε is defined to prevent extremely small positive numbers with a denominator of zero.

[0108]

[0109] The relative activation value is calculated by dividing the current EMG amplitude by the corresponding baseline, ensuring that the control variable primarily reflects changes relative to the individual's own baseline, rather than directly using absolute voltage values. This can, to some extent, reduce the impact of individual differences, electrode contact status, and variations in baseline amplitude across different recording files on the threshold. The baseline can be kept fixed or re-estimated using a slow update approach once a period of no stimulation and stable EMG is confirmed.

[0110] S42, construct the muscle group relationship index between TA and GS.

[0111] To describe the relative activation relationship between the safety restraint muscles and the main feedback muscles, the TA / GS ratio is defined. :

[0112] when An elevated TA ratio indicates increased activation relative to GS, potentially reflecting uncoordinated activation between flexor and extensor muscles or excessive involvement of antagonist muscles. This ratio does not determine whether stimulation is shut off independently, but rather in conjunction with... , And the combination of co-activated states forms a safety constraint term. When both GS and TA are above their respective co-activation thresholds, the co-activation flag can be enabled, thereby increasing the strength of the security constraints.

[0113] S43, Construct a fatigue index based on changes in median frequency.

[0114] Let the baseline median frequency of the main feedback muscle GS be . The current window mid-frequency is Then fatigue indexes can be defined. :

[0115] When MDF decreases relative to baseline An increase indicates a higher risk of fatigue. To prevent spectrum fluctuations within a single window from directly causing protection shutdown, adjustments can be made to... Perform sliding average or continuous window confirmation, and set soft and hard thresholds: when the soft threshold is reached, limit further escalation or shorten the duration of continuous stimulation; when the hard threshold is reached, prioritize turning off stimulation and enter a protective state.

[0116] S44, define the GS target activation interval and calculate the deviation and the rate of change of deviation.

[0117] Let the relative activation interval of the GS target be... .when When this occurs, it indicates insufficient activation of the primary feedback muscles, requiring a tendency to initiate or upshift; when When the level is within the target range, it indicates that the current activation level is relatively appropriate; when... When this occurs, it indicates that the primary feedback muscle has reached or exceeded the expected range, requiring a tendency to downgrade or inhibit stimulation. The deviation E(k) is defined as: when... When, E(k) = ;when When, E(k) = 0; when When, E(k) = .

[0118] E(k) describes the degree to which the current activation level is insufficient or excessive relative to the target interval, while ΔE(k) describes whether the deviation between adjacent control steps is decreasing or continuing to increase. The rate of change of deviation is defined as ΔE(k) = E(k) - E(k-1). When used together, the controller can distinguish between two states: "still insufficient but improving" and "still insufficient and continuing to deteriorate," allowing stimulus modulation to not rely solely on the amplitude at a single moment. When there is a window that does not meet the quality requirements, E(k-1) is taken as the deviation value of the most recent effective window before the current window; that is, the rate of change of deviation is calculated between adjacent effective windows.

[0119] S45 converts the state recognition probability, safety constraints, and fatigue constraints into control inputs.

[0120] The state recognition model outputs P_SCI(k) as a state auxiliary term; by , Constructing TA security constraint terms with the activation flag. ;Depend on And its soft and hard threshold states to construct fatigue constraint terms In ordinary control, Used to enhance the startup or upshift trend in SCI mode. and It participates in control in the direction of inhibiting stimulation; under hard safety conditions, safety constraints have a higher execution priority than ordinary integrated control quantities.

[0121] S5 executes closed-loop stimulus amplitude control with GS as the main feedback and TA as the safety constraint.

[0122] S51, Calculate the comprehensive control quantity.

[0123] Within each control window, the GS deviation, deviation change rate, SCI state auxiliary probability, TA safety constraint, and fatigue constraint are input into the controller to form the comprehensive control quantity Y(k):

[0124] Where w1 to w5 are the corresponding weights. The main feedback term E(k) and ΔE(k) determine the main direction of stimulus modulation. Used to help distinguish states that require compensation. and This is used to limit uncoordinated muscle group activity and fatigue risk. The weights can be tuned through near real-time playback, dynamic simulation, and hardware-in-the-loop testing to ensure sufficient triggering capability for the SCI group while suppressing false triggering in the intrinsic group.

[0125] S52 updates the finite discrete stimulation level based on the comprehensive control value.

[0126] Let L(k) be the index of the current stimulation level. The threshold for upgrading, Let L_max be the downshift threshold and L_max be the maximum gear index. Under the condition that hard safety protection is not triggered and upshifting is allowed during the refractory period, the following discrete update is used: when Y(k) > When, L(k+1) = min[L(k)+1, L_max]; when ≤Y(k)≤ When L(k+1) = L(k); when Y(k) < When, L(k+1) = max[L(k)-1, 0].

[0127] The stimulation levels change in integer increments, which avoids the controller outputting consecutive values ​​with excessively large amplitude spans between adjacent time windows. This also matches the engineering implementation of programmable stimulation devices that execute at fixed amplitude levels. Level 0 indicates stimulation is off, and the other levels are mapped to different non-zero stimulation amplitudes.

[0128] S53 sets TA security constraints and hierarchical protection logic.

[0129] Safety protection is divided into a hard safety layer and a soft safety layer. The hard safety layer handles high-risk conditions such as excessive TA activation, excessively high TA / GS ratio, significant co-activation, significantly increased fatigue risk, communication anomalies, or malfunctions of the stimulation device. If any hard safety condition is met, the controller prioritizes setting the next stimulation level to 0 and can enter a short-term protection state. The soft safety layer handles mild risks that have not yet reached the mandatory shutdown condition. In this case, stimulation is not directly shut down; instead, further escalation is prohibited, significant escalation is corrected to hold, continuous stimulation time is shortened, or the threshold for re-escalation is raised. In a preferred embodiment, when a soft safety condition is met and the normal control action is to escalate, the escalation action is corrected to hold; when the normal control action is hold, downgrade, or shut down, the soft safety condition does not allow it to escalate. When a hard safety condition is met, it is directly set to zero, without being restricted by the normal step-by-step adjustment rules.

[0130] TA (Transient Assist) safety constraints are used to supplement insufficient GS (Gastrosporin's) primary feedback. Insufficient GS activation itself may indicate a need for increased stimulation, but if TA is also significantly activated at the same time, or... A higher amplitude indicates that the flexor and extensor muscles may be in a state of incoordination. In this case, simply increasing the stimulation amplitude may amplify the activity of non-target muscles; therefore, by... A negative correction is applied to the overall control input, and the stimulus is directly shut off when the hard threshold is reached.

[0131] S54, set probability-assisted startup.

[0132] When the current stimulus level is 0, relying solely on the GS amplitude may result in insufficient activation of some SCI samples; therefore, a probability-assisted activation mechanism is implemented. Reaching the start probability threshold , Still below the maximum allowed for assisted startup If neither the TA safety constraint nor the fatigue constraint is triggered, the system is allowed to enter the lowest non-zero gear from gear 0. This startup mechanism only changes the entry condition from "off" to "lowest gear" and does not bypass the subsequent GS main feedback, safety constraints, and protection logic. Its trigger condition is: When all the above conditions are met, and the current stimulation level is 0, the system will activate the lowest stimulation level. .

[0133] S55 sets a refractory period to limit the frequent scaling up of adjacent windows.

[0134] After each startup, upshift, downshift, or protection shutdown, the refractory period counter R(k) is set to a preset positive integer. While R(k) > 0, the controller allows holding, downshifting, and shutdown, but restricts further upshifting; the refractory period counter decrements with each control step. This mechanism reduces continuous upshifting and repeated jumps between adjacent levels caused by short-term electromyographic fluctuations, resulting in a certain time lag and smoothness in the stimulation amplitude. Therefore, the refractory period only revokes the permission to upshift again, without preventing holding, downshifting, or shutdown.

[0135] When R(k)>0, restrict L(k+1)>L(k); after each control step, R(k+1)=max[R(k)-1,0].

[0136] S56, set low duty cycle protection to limit long-term continuous stimulation.

[0137] Record the number of control windows for consecutive non-zero stimuli .when Reaching the maximum allowed number of consecutive stimulation windows When the system enters a resting state, L(k) is forced to 0 within a preset rest window. After the rest period, the continuous stimulation count is cleared or reset, and the system re-evaluates whether the activation conditions are met based on the latest electromyographic feedback. Through periodic rest, even if SCI state and GS insufficiency persist for a long time, the average stimulation duty cycle can be reduced, preventing the controller from continuously outputting non-zero stimuli for a long time.

[0138] S57, determine the execution priority of the closed-loop action.

[0139] Within the same control window, main feedback upshifting tendency, TA safety suppression, fatigue protection, and refractory period limitation may occur simultaneously; therefore, action priorities are set. The preferred execution order is: first, check for communication and equipment anomalies and hard safety conditions; second, check for low duty cycle resting states; third, execute soft safety constraints and refractory period limitations; under conditions where none are prohibited, calculate the general integrated control quantity and execute upshifting, holding, or downshifting; when the current gear is 0, determine the probability-assisted start condition. This ensures that safety-related actions always have a higher priority than ordinary upshifting actions. The safety supervision does not modify already generated downshifting or closing actions to hold or upshift; the state-assisted probability only applies to the general control layer and cannot bypass hard safety, soft safety, refractory period, or resting states.

[0140] S6, such as Figure 5 and Figure 6 As shown, a Python closed-loop dynamic simulation is established to verify the stability of the controller under feedback change conditions.

[0141] S61, construct an abstract neuromuscular state that can change with stimulus input.

[0142] Near real-time file playback can only replay existing electromyographic waveforms; the stimulus output will not, in turn, change subsequent electromyographic data in the original file. To pre-verify the control behavior under true closed-loop conditions, an abstract dynamic state x(k) can be established in Python, including components such as the main feedback muscle activation state, the safety constraint muscle activation state, the fatigue state, and random disturbances, and the stimulus amplitude u(k) can be used as the external control input.

[0143] x(k+1) = f[x(k),u(k),w(k)] Where w(k) represents noise, individual fluctuations, or unmodeled disturbances. Based on the state x(k), simulated GS and TA electromyographic feedback or their characteristics are generated, and then input into the state recognition and closed-loop controller to obtain the stimulation level for the next control step, so that the simulation forms a cycle of "state-feedback-discrimination-control-output-state update".

[0144] S62 executes the closed-loop control process step by step in dynamic simulation.

[0145] Each simulation control step first reads the current state and generates... , MDF(k) and After receiving feedback, calculate the control variable according to step S4, output the gear level L(k) according to step S5, and then input the corresponding stimulus amplitude as u(k) into the state update equation to obtain the state x(k+1) at the next moment. By repeating this process, it can be observed whether the controller starts when GS is insufficient, maintains or downshifts after feedback improvement, shuts off for protection when TA risk and fatigue increase, and enters a rest period when the continuous stimulation time is too long.

[0146] S63 uses dynamic simulation to check for control logic oscillation and long-term high duty cycle issues.

[0147] Different closed-loop scenarios can be constructed by changing the initial state of the simulation, feedback noise, stimulus response intensity, and fatigue growth rate. When the stimulus causes the GS activation to gradually approach the target range, the controller should switch from increasing the level to maintaining the level and decreasing the level if necessary; when the TA relative activation increases rapidly, further increasing the level should be limited; when the feedback oscillates around the threshold, the refractory period should reduce the frequency of level jumps; when the sustained stimulus reaches... When low duty cycle protection is activated, it should be forced into a rest state. If continuous full duty cycle, rapid shifting, or safety constraint failure occurs during simulation, the weights, thresholds, and protection parameters need to be readjusted.

[0148] S7 converts the closed-loop algorithm output into hardware instructions that can be executed by a non-invasive spinal cord stimulation device.

[0149] S71, such as Figure 7 As shown, a closed-loop stimulus hardware execution terminal is constructed.

[0150] The hardware execution end employs a programmable multi-channel non-invasive spinal cord electrical stimulation device. The device may include a main unit, output leads, electrode interfaces, and a power supply module; the main unit internally includes a control unit, a stimulation output module, and a current feedback unit. The control unit receives stimulation parameters set by a host computer or internal program and controls the stimulation output module to generate corresponding electrical pulses; the current feedback unit monitors the output status, ensuring the device maintains a relatively stable constant current output under certain load conditions. The output status of the current feedback unit is provided to the safety monitoring module; when the output current deviates from the target range, the output is interrupted, or the feedback status is abnormal, the safety monitoring module identifies this as a malfunction of the stimulation device and triggers a protection shutdown.

[0151] In this invention, the stimulation device is not used as an independent device with fixed parameters, but rather as the execution end of a closed-loop algorithm. A Python host computer generates stimulation amplitude levels based on the GS / TA electromyography analysis results and communicates with the device via a USB-to-serial converter, enabling the device to dynamically change the stimulation intensity in different control windows according to the closed-loop algorithm.

[0152] S72, such as Figure 8 As shown, the stimulus waveform format and fixed parameters of the hardware output are set.

[0153] In one hardware verification embodiment of the present invention, a symmetrical biphasic rectangular wave is output using a single-channel CH1. The waveform consists of positive and negative pulses from the same stimulation channel, with consistent amplitudes and widths of both pulses to reduce unidirectional charge accumulation. During hardware testing, the stimulation frequency and pulse width are fixed, and only the stimulation current amplitude is dynamically changed, thereby highlighting the closed-loop algorithm's role in regulating stimulation intensity and reducing coupling caused by simultaneous changes in multiple parameters.

[0154] The hardware test parameters are as follows: stimulation channel CH1; waveform is a symmetrical biphasic rectangular wave; stimulation frequency is 50Hz; positive phase pulse width is 5ms, and negative phase pulse width is 5ms. It should be noted that the above 5ms / 5ms are parameters used in one hardware communication and output test implementation method of this invention, used to illustrate the hardware verification process; in other stimulation devices or applications, other pulse widths or frequencies can be set while meeting device and safety requirements.

[0155] S73 establishes a serial communication interface between the host computer and the electrical stimulation device.

[0156] The stimulation device is connected to the computer via a USB-to-serial adapter, and the device is mapped as a virtual COM port on the computer. Serial communication parameters are set to 115200 baud rate, 8 data bits, 1 stop bit, and no parity. A Python program handles port opening, parameter setting, instruction construction, instruction transmission, and transmission status recording. After each control window ends, the program determines whether the target amplitude has changed based on the new stimulation level and sends new stimulation parameters as needed. The transmission status includes one or more of the following: port open status, instruction transmission result, and device response status. When the transmission status does not meet the preset communication requirements, the program generates a communication exception flag and provides it to the safety monitoring module.

[0157] The sending command may include the device channel number, parameter address, amplitude data, and other fields required by the device protocol. After receiving the control fields, the device control unit executes the parameter writing and controls the stimulation output module to change the current amplitude. The hardware interface program simultaneously records information such as the control window number, algorithm target level, target amplitude, sending command, and corresponding register value to compare the consistency between the algorithm decision and the device execution. The current feedback unit returns the actual output state to the safety monitoring module; when the actual output state does not meet the preset output requirements, a stimulation device abnormality flag is generated. When the communication abnormality flag or the stimulation device abnormality flag is valid, the safety monitoring module prioritizes generating a shutdown action and sets the stimulation level to zero.

[0158] S74 maps the stimulation level to a finite current amplitude.

[0159] The hardware test uses five levels: 0, 1, 2, 3, and 4, which are mapped to 0.0mA, 0.5mA, 1.0mA, 1.5mA, and 2.0mA, respectively. 0.0mA indicates no effective stimulus output. Based on the closed-loop control results of each sliding window, the program simultaneously writes the corresponding amplitude into the positive and negative pulse amplitude parameters of the biphasic rectangular wave, ensuring the device output remains biphasic and symmetrical.

[0160] A(k) = ,in ∈{0.0, 0.5, 1.0, 1.5, 2.0}mA.

[0161] In other stimulation devices, more or fewer discrete levels can be set, and different maximum amplitude values ​​can be used; the key is that the level or amplitude output by the closed-loop controller can be reliably converted into executable parameters of the device via the communication interface.

[0162] S8, such as Figure 9 As shown, near real-time playback of electromyography and hardware-in-the-loop closed-loop response were verified.

[0163] S81 reads existing GS / TA electromyography files in near real-time according to the control window sequence.

[0164] A set of paired GS / TA electromyography (EMG) CSV files is selected as the feedback input. The host computer reads the data sequentially in 200ms windows with 50ms steps. Within each control window, preprocessing and feature calculation are performed first, followed by obtaining the GS main feedback quantity, TA safety constraints, SCI auxiliary probability, and fatigue index. Then, the closed-loop controller is called to obtain the current stimulation level. This process preserves the temporal order of the original EMG files, allowing the stimulation decision to change window by window as the EMG state in the files changes.

[0165] S82 generates a non-zero stimulus amplitude instruction when the triggering condition is met.

[0166] When the SCI auxiliary probability is high, the GS main feedback shows insufficient activation, and neither the TA safety constraint nor the fatigue constraint is triggered, the controller outputs the lowest non-zero level or gradually increases the level according to the comprehensive control quantity; when the GS enters the target range, it maintains the current level; when the GS is too high, the TA risk increases, the fatigue increases, or the protection gate is triggered, the controller downshifts or shuts off the stimulus. Therefore, the stimulus does not continuously apply a fixed intensity to the entire SCI file, but rather appears intermittently during the time period that satisfies the closed-loop conditions.

[0167] In typical SCI file hardware-in-the-loop results, during the time period when the GS / TA feedback meets the triggering condition, the closed-loop output shows the corresponding stimulus amplitude; the state-assisted probability, trigger state, and stimulus amplitude changes correspond to each other in time. Within the trigger interval, the hardware outputs a symmetrical biphasic rectangular wave corresponding to the amplitude command.

[0168] S83 sends the closed-loop stimulation command to the electrical stimulation device via the serial port and observes the actual waveform.

[0169] The host computer converts the target amplitude generated by the current control window into a stimulation device control field and sends it through the virtual COM port.

[0170] S84 forms a complete hardware-in-the-loop closed-loop test link.

[0171] Following the above process, a complete test chain is constructed, consisting of "near real-time playback of EMG files - EMG preprocessing - sliding window and feature calculation - state-assisted recognition - GS main feedback and TA safety constraint closed-loop decision-making - stimulation level update - serial port transmission of stimulation commands - output of biphasic rectangular wave by electrical stimulation device - oscilloscope observation". This chain connects the aforementioned algorithm simulation with the hardware execution process, used to verify the executability of the closed-loop control logic at the stimulation device end and the consistency between the stimulation amplitude command and the actual output waveform.

[0172] S85 continuously reads the next control time window and updates the stimulus output.

[0173] After completing the decision-making and hardware execution for the current window, move the window forward by one step, read the GS / TA electromyography data for the next time segment, and re-execute steps S2 to S8. Since adjacent windows share some data but have new end samples, , , The MDF (Mean Distribution Function) and safety status change over time, and the stimulation level dynamically switches between off, on, up, hold, down, and protective rest. This repetitive process forms a continuous closed-loop control, rather than a one-time classification and fixed stimulation.

[0174] The main feedback muscles and safety constraint muscles can be replaced with other muscle groups depending on the target motor task, and can also be expanded from two muscle pathways to three or more pathways. The state recognition model can use an ensemble model selected by AutoGluon, XGBoost, random forest, support vector machine, or neural network; the controller can use weighted comprehensive control quantity, normalized fuzzy control, or a combination of both; the communication interface can use other reliable wired or wireless communication methods in addition to USB to serial port. The above substitutions do not change the basic technical idea of ​​this invention, which utilizes electromyographic feedback to evaluate neuromuscular state in real time and dynamically adjusts the amplitude of non-invasive spinal cord electrical stimulation through the main feedback, safety constraint, and protection mechanisms.

[0175] The above specific embodiments are used to illustrate the technical solution of the present invention and are not intended to limit the scope of protection of the present invention. Equivalent substitutions made by those skilled in the art based on the disclosure of the present invention for electromyographic pathway selection, filtering parameters, window length, feature combination, state recognition model, target interval, threshold, weight, fuzzy rules, machine learning enhancement methods, stimulation levels, stimulation frequency, pulse width, communication protocol, and hardware platform, as long as they still form a non-invasive spinal cord electrical stimulation closed-loop control process driven by electromyographic feedback and subject to safety constraints, are all variations that can be covered by the technical solution of the present invention.

Claims

1. A method for generating control parameters for a non-invasive spinal cord stimulation device, characterized in that, Includes the following steps: S1, receiving continuous electromyographic signals from at least two muscle pathways related to the target motor function, configuring one muscle pathway as the main feedback pathway and the other muscle pathway as the safety constraint pathway; the safety constraint pathway and the main feedback pathway are antagonistic, or the abnormal activation of the safety constraint pathway and the main feedback pathway can characterize the incoordination of the target motor function. S2, preprocess the continuous electromyographic signals, and divide the window into sliding windows according to the preset window length and window step size to obtain window-level electromyographic data arranged in chronological order; S3. Based on the window-level electromyography data of the current window, and based on the normalization results of the current window electromyography amplitude of the main feedback pathway and the safety constraint pathway relative to the corresponding baseline electromyography amplitude, determine the relative activation amount of the main feedback and the relative activation amount of the safety constraint and the relative activation amount of the main feedback respectively, and determine the dimensionless relative activation relationship of muscle groups based on the ratio of the relative activation amount of the safety constraint to the relative activation amount of the main feedback. The fatigue index is determined based on the degree of decrease in the median electromyography frequency of the main feedback pathway within the current window relative to the baseline median frequency. S4, input the time-domain features and / or frequency-domain features extracted from the window-level electromyography data into the pre-trained neuromuscular state recognition model to obtain the auxiliary probability of the target neuromuscular state corresponding to the current window; S5, based on the deviation of the main feedback relative activation amount from the target activation interval, a main feedback adjustment amount is formed to make the main feedback relative activation amount tend towards the target activation interval. Based on the safety constraint relative activation amount, the muscle group relative activation relationship, and the fatigue index, a safety constraint amount is formed in the opposite direction to increasing the stimulus output. The auxiliary probability is used as an auxiliary adjustment amount that only participates in ordinary control and cannot trigger the stimulus level to be updated from zero to non-zero on its own, and cannot cover the safety constraint. The main feedback adjustment amount, the safety constraint amount, and the auxiliary adjustment amount are combined to construct a comprehensive control amount. S6. Based on the relationship between the comprehensive control quantity and the preset upgrade threshold and the preset downgrade threshold, generate a normal stimulus control action of upgrade, hold or downgrade. S7. Constrain the normal stimulation control action according to the preset safety execution priority: when the normal stimulation control action is to increase the level, and the relative activation relationship of the muscle group or the fatigue index reaches the corresponding warning threshold but not the corresponding hard safety threshold, the increase action is replaced with a hold action; when the relative activation relationship of the muscle group, the co-activation degree of the main feedback pathway and the safety constraint pathway, or the fatigue index reaches the corresponding hard safety threshold, or a communication abnormality or stimulation device abnormality occurs, the normal stimulation control action is overridden with a shut-off action and the stimulation level is set to zero; when the normal stimulation control action is to decrease the level or shut down, the safety constraint does not change it to hold or increase the level; increasing the level is prohibited within a preset number of windows after the stimulation level changes or stimulation is interrupted due to the safety constraint; When the number of consecutive non-zero stimuli reaches the preset number window, the stimulation level will be set to zero and will remain at zero within the preset rest number window. S8, when not set to zero and having corresponding control permissions, update the finite discrete stimulation level according to the constrained stimulation control action, wherein the stimulation level change caused by the ordinary stimulation control action between adjacent windows is at most one level, and the closing action is not limited by the step-by-step change; convert the finite discrete stimulation level into stimulation parameters that the non-invasive spinal cord stimulation device can execute according to the preset mapping relationship; S9, generate control instructions containing the stimulation parameters and output them to the communication interface; acquire the electromyographic data of the next window according to the time sequence, and repeat steps S3 to S9 so that the stimulation parameters are updated with continuous electromyographic feedback.

2. The control parameter generation method according to claim 1, characterized in that, The main feedback pathway and the safety constraint pathway are determined as follows: neuromuscular state recognition models are established for multiple candidate muscle pathways respectively; the state discrimination ability of the multiple candidate muscle pathways is compared based on at least one evaluation index among window-level F1 value, balance accuracy, Matthews correlation coefficient, area under ROC curve and full file-level majority voting results; and the motor function correlation and signal stability of each candidate muscle pathway are combined to configure the muscle pathway with state discrimination ability and signal stability meeting preset conditions as the main feedback pathway, and another muscle pathway that can reflect antagonistic activity, abnormal co-activation or stimulation risk is configured as the safety constraint pathway.

3. The control parameter generation method according to claim 1 or 2, characterized in that, The main feedback pathway is the gastrocnemius muscle electromyography pathway, and the safety constraint pathway is the tibialis anterior muscle electromyography pathway.

4. The control parameter generation method according to claim 1, characterized in that, The preprocessing in step S2 includes at least one of the following: target channel extraction, bipolar differential, DC offset removal, bandpass filtering, power frequency interference suppression, Hampel-MAD-based abnormal spike detection and repair, and wavelet soft threshold candidate denoising.

5. The control parameter generation method according to claim 4, characterized in that, For at least one of the features, namely the root mean square value, the power of the preset frequency band, and the median frequency, calculate the feature change between the abnormal peak repair result and the wavelet soft threshold candidate denoising result; When the change of each selected feature does not exceed the corresponding preset fidelity threshold, the wavelet soft threshold candidate denoising result is used; when the change of any selected feature exceeds the corresponding preset fidelity threshold, the abnormal peak repair result is used.

6. The control parameter generation method according to claim 1, characterized in that, The window length for generating control parameters is 200ms, and the window step size is 50ms.

7. The control parameter generation method according to claim 1, characterized in that, The neuromuscular state recognition model divides the training set and test set according to the original electromyography (EMG) file. All window-level EMG data corresponding to the same original EMG file are only assigned to one of the training set and the test set. The neuromuscular state recognition model is a model selected by an automatic machine learning framework, such as a gradient boosting tree model, a random forest model, a support vector machine model, or a neural network model, and outputs the predicted probability of the target neuromuscular state.

8. The control parameter generation method according to claim 1, characterized in that, The current window EMG amplitude is the root mean square (RMS) value of the current window EMG, and the baseline EMG amplitude is the RMS value of the baseline phase EMG; the main feedback relative activation and the safety constraint relative activation are normalized values ​​of the corresponding current window EMG RMS value relative to the corresponding baseline EMG RMS value; the deviation rate between the main feedback relative activation and the target activation interval is calculated based on adjacent effective windows.

9. The control parameter generation method according to claim 1, characterized in that, The fatigue index only participates in the control along the direction of inhibiting stimulus output, and the fatigue index is confirmed by sliding average and / or continuous window; when the fatigue index reaches the soft fatigue threshold, the upshift action is replaced by the hold action, and when the fatigue index reaches the hard fatigue threshold which is higher than the soft fatigue threshold, the stimulus level is set to zero.

10. The control parameter generation method according to claim 1, characterized in that, When the comprehensive control quantity is greater than the preset upgrade threshold and has upgrade authority, the finite discrete stimulation level increases by one level until the maximum level; when the comprehensive control quantity is equal to the preset upgrade threshold, equal to the preset downgrade threshold, or located in between, the current level is maintained. When the comprehensive control quantity is less than the preset downgrade threshold, the finite discrete stimulation level is reduced by one level until it reaches zero.

11. The control parameter generation method according to claim 1, characterized in that, When the relative activation amount of the main feedback and the relative activation amount of the security constraint reach their respective co-activation thresholds, it is determined that the degree of co-activation has reached the hard security threshold. The communication anomaly is determined based on the transmission status of the communication interface, and the stimulation device anomaly is determined based on the current feedback status.

12. The control parameter generation method according to claim 1, characterized in that, The finite discrete stimulation levels include levels 0 to 4, which are mapped to 0.0mA, 0.5mA, 1.0mA, 1.5mA and 2.0mA respectively; the communication interface is a USB to serial communication interface, and the serial communication parameters include a baud rate of 115200, 8 data bits, 1 stop bit and no parity.

13. A closed-loop non-invasive spinal cord electrical stimulation control system based on electromyographic signal feedback, characterized in that, It includes an electromyography signal acquisition module, a signal preprocessing module, a sliding window partitioning module, a feature calculation module, a state recognition module, a control variable construction module, a closed-loop control module, a safety monitoring module, a stimulation level mapping module, a communication interface module, and a non-invasive spinal cord stimulation module; The electromyography (EMG) signal acquisition module is used to acquire continuous EMG signals of the main feedback pathway and the safety constraint pathway related to the target motor function. The safety constraint pathway and the main feedback pathway are antagonistic, or the abnormal joint activation of the safety constraint pathway and the main feedback pathway can characterize the incoordination of the target motor function. The signal preprocessing module is connected to the electromyography signal acquisition module and is used to preprocess the continuous electromyography signals; The sliding window partitioning module is used to divide the preprocessed continuous electromyographic signals into window-level electromyographic data arranged in chronological order. The feature calculation module is used to determine the relative activation amount of the main feedback and the relative activation amount of the safety constraint based on the normalized results of the current window electromyography amplitude values ​​of the main feedback pathway and the safety constraint pathway relative to the corresponding baseline electromyography amplitude values ​​in the current window, respectively. It determines the dimensionless relative activation relationship of muscle groups according to the ratio of the relative activation amount of the safety constraint to the relative activation amount of the main feedback, and determines the fatigue index according to the degree of decrease of the median frequency of the electromyography of the main feedback pathway relative to the median frequency of the baseline. The state recognition module is used to input the time-domain features and / or frequency-domain features of the window-level electromyography data into a pre-trained neuromuscular state recognition model to obtain the auxiliary probability of the target neuromuscular state. The control variable construction module is used to form a main feedback adjustment quantity that tends towards the target activation interval based on the deviation of the main feedback relative activation quantity from the target activation interval, form a safety constraint quantity that is opposite to increasing the stimulus output based on the safety constraint relative activation quantity, the muscle group relative activation relationship and the fatigue index, and use the auxiliary probability as an auxiliary adjustment quantity that only participates in ordinary control and cannot trigger the stimulus level to be updated from zero to non-zero level on its own and cannot cover the safety constraint. The main feedback adjustment quantity, the safety constraint quantity and the auxiliary adjustment quantity are combined to construct a comprehensive control quantity. The closed-loop control module is used to generate ordinary stimulus control actions of upshifting, maintaining, or downshifting based on the comprehensive control quantity. The safety monitoring module is used to constrain the normal stimulation control action according to a preset safety execution priority. Specifically, when the normal stimulation control action is to increase the intensity level, and the relative activation relationship of the muscle group or the fatigue index reaches the corresponding warning threshold but not the corresponding hard safety threshold, the increase action is replaced with a hold action. When the relative activation relationship of the muscle group, the co-activation degree of the main feedback pathway and the safety constraint pathway, or the fatigue index reaches the corresponding hard safety threshold, or a communication abnormality or stimulation device malfunction occurs, a close action is used to override the normal stimulation control action, and the stimulation level is set to zero. When the normal stimulation control action is to decrease the intensity level or close, the safety constraint does not change it to hold or increase the intensity level. Increasing the intensity level is prohibited within a preset number of windows after the stimulation level changes or stimulation is interrupted due to safety constraints. When the number of consecutive non-zero stimuli reaches the preset number window, the stimulation level will be set to zero and kept at zero within the preset rest number window. The stimulation level mapping module is used to update the finite discrete stimulation levels according to the constrained stimulation control actions when the stimulation level is not set to zero and has the corresponding control permissions, so that the stimulation level change caused by the normal stimulation control actions between adjacent windows is at most one level, the closing action is not restricted by the step-by-step change, and the finite discrete stimulation levels are converted into stimulation parameters. The communication interface module is used to send control commands containing the stimulation parameters to the non-invasive spinal cord stimulation module. The non-invasive spinal cord electrical stimulation module is used to generate corresponding electrical stimulation waveforms according to the stimulation parameters; each module repeatedly runs for window-level electromyographic data arranged in chronological order so that the stimulation parameters are updated with continuous electromyographic feedback.

14. The closed-loop non-invasive spinal cord electrical stimulation control system according to claim 13, characterized in that, The non-invasive spinal cord stimulation module includes a control unit, a stimulation output module, a current feedback unit, output leads, and a surface electrode interface. The control unit receives the control command via the communication interface module and controls the stimulation output module to output a pulse current of corresponding intensity. The current feedback unit monitors the output status of the stimulation output module and provides the output status to the safety monitoring module to identify abnormalities in the stimulation device.

15. The closed-loop non-invasive spinal cord electrical stimulation control system according to claim 13 or 14, characterized in that, The non-invasive spinal cord stimulation module outputs a symmetrical biphasic rectangular wave through a single stimulation output channel. The positive and negative phase pulses of the symmetrical biphasic rectangular wave have the same amplitude and pulse width. During the closed-loop control process, the stimulation frequency and pulse width remain unchanged, and the stimulation current amplitude is dynamically changed according to the finite discrete stimulation levels.

16. The closed-loop non-invasive spinal cord electrical stimulation control system according to claim 13, characterized in that, The communication interface module includes a USB-to-serial interface and records log information including at least the control window number, target stimulation level, and sent instructions; the control instructions include at least the stimulation channel number, parameter address, and amplitude data.