A rehabilitation guidance system and method for thoracic surgery patients
In the postoperative rehabilitation guidance system of thoracic surgery, the frequency band energy feature set triggered by physical switches and the joint trajectory difference of the twin network compared to the instrument state, combined with the causal forest model and the dynamic spectrum of respiratory resistance and the joint space-time synergy index, the problem of difficulty in distinguishing active rehabilitation and compensatory actions in the existing technology is solved, and real-time optimization and precise decision-making support of personalized training parameters are achieved.
Patent Information
- Application Number
- CN202510372843.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-03-27
AI Technical Summary
In the prior art, in the postoperative rehabilitation guidance of thoracic surgery, it is difficult to distinguish the nonlinear coupling relationship between active rehabilitation efforts in exercise signals and compensatory actions caused by pain, resulting in multiple collinearity in the behavioral feature space. Compensatory actions are misjudged as training actions to generate rehabilitation intensity suggestions that deviate from clinical guidelines.
By triggering the timing alignment of inertial sensor data flow based on physical switches, extracting the anti-interference band energy feature set, constructing a twin network to compare the joint trajectory differences in the enabled/disabled state of the device, using the causal forest model to analyze the causal relationship between sensor channels and rehabilitation effectiveness, fusing the dynamic spectrum of respiratory resistance and joint space-time synergistic index, and screening out mixed characteristics through adversarial pre-training, and finally generating evaluation indicators with both timing sensitivity and pathological interpretation.
Real-time closed-loop optimization of personalized training parameters is realized, providing real-time and accurate decision-making support for the adjustment of personalized training plans, and significantly enhancing the clinical applicability and practical value of the system.
Smart Images

Figure CN119889728B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of medical rehabilitation guidance, and more specifically, to a rehabilitation guidance system and method for thoracic surgery patients. Background Art
[0002] In a postoperative rehabilitation guidance system for thoracic surgery, a behavior capture system based on an inertial measurement unit (IMU) and a depth camera continuously collects high-dimensional behavior data such as the three-dimensional motion trajectory, joint angle changes, and breathing pattern of a patient, for quantitatively evaluating the execution quality of rehabilitation actions such as breathing training and coughing drills. These data need to decouple effective motion features reflecting the real rehabilitation progress in real scenarios with home environment interference and patient subjective behavior deviation in real time, providing a decision basis for adjusting personalized training plans.
[0003] However, existing dimensionality reduction methods based on principal component analysis (PCA) and linear discriminant analysis (LDA) can compress the data dimension, but cannot distinguish the non-linear coupling relationship between the active rehabilitation effort and pain-induced compensatory movements in the motion signal. The coupling effect of such confounding variables results in multicollinearity in the behavior feature space, causing the supervised learning model to misjudge the time-frequency features of compensatory movements as the standard execution mode of training actions, and then generating rehabilitation intensity suggestions that deviate from clinical guidelines. The essential problem is that traditional feature engineering lacks the ability of causal modeling of the behavior data generation mechanism, and it is difficult to establish cross-modal constraint relationships between instrument usage records and environmental sensor data to achieve identifiable separation of confounding factors.
[0004] To solve the above problems, a technical solution is provided now. Summary of the Invention
[0005] To overcome the above-mentioned defects of the prior art, embodiments of the present invention provide a rehabilitation guidance system and method for thoracic surgery patients. First, based on the physical switch trigger to align the inertial sensor data stream, an anti-interference frequency band energy feature set is extracted through joint time-frequency domain analysis, effectively overcoming home environment noise interference and ensuring high-fidelity capture of motion data; further, a twin network is constructed to compare the joint trajectory differences in the instrument enabled / disabled states, accurately quantifying the reconstruction intensity of instrument-driven actions on the motion mode; using the instrument usage frequency as an instrumental variable to drive a causal forest model, analyzing the causal relationship between each sensor channel and rehabilitation effectiveness, synchronously fusing the dynamic spectrum of respiratory resistance and the joint spatio-temporal coordination index, and screening out confounding features through adversarial pre-training; finally, based on the respiratory phase, the time-domain feature clusters are dynamically divided, and hierarchical fusion is implemented with frequency band energy attention to generate evaluation indicators with both time series sensitivity and pathological interpretability, realizing real-time closed-loop optimization of personalized training parameters, providing real-time and accurate decision support for adjusting personalized training plans, thereby significantly enhancing the clinical applicability and practical value of the system to solve the problems raised in the above background art.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] A rehabilitation guidance method for thoracic surgery patients, comprising the steps of:
[0008] S1. Based on the trigger moments of the start and stop events of the physical switch of the breathing trainer, determine the time anchors of the instrument activation period in the inertial sensor data stream, and extract the band energy distributions of the accelerometers in each axis within a preset window before and after the time anchor, and construct a band energy feature set associated with the instrument use;
[0009] S2. Input the band energy feature set into the Siamese network, calculate the similarity of the same joint movement trajectories in the instrument activation and non-activation states through contrastive learning, and generate a contrastive representation of the compensatory action and the standard action;
[0010] S3. Using the instrument usage frequency as an instrumental variable, adopt the causal forest model to perform counterfactual reasoning on the contrastive representation, and obtain the channel importance scores of each sensor channel for the effectiveness of the rehabilitation action;
[0011] S4. Mine the key representations related to the dynamic breathing resistance information and joint movement information, input them into the pre-trained model, adaptively adjust the screening threshold according to the value output by the model, and screen out the pure representations with channel importance scores higher than the adjusted threshold;
[0012] S5. Perform time-domain grouping on the pure representations according to the breathing waveform phase, implement frequency-domain weighting with the band energy as the attention weight, and generate the final evaluation result through hierarchical attention fusion.
[0013] In a preferred embodiment, step S1 includes the following content:
[0014] By analyzing the trigger moments of the start and stop events of the physical switch of the breathing trainer and combining with the acceleration changes in the inertial sensor data stream, locate the moment of instrument state switching, and extract the three-axis acceleration data within a preset time window before and after this as the center; then perform a fast Fourier transform on the acceleration data within the corresponding time window to convert the time-domain signal into a frequency-domain signal, and divide the frequency domain into multiple sub-bands; then for each sub-band, calculate the energy of each axis and perform normalization processing to obtain the relative energy distribution; finally, arrange the normalized energy values of each axis and each sub-band in order to construct a feature vector as the band energy feature set associated with the instrument use.
[0015] In a preferred embodiment, step S2 includes the following content:
[0016] When constructing the frequency band energy feature sets in the activated state and non-activated state of the treatment device, a siamese network architecture is built, which includes two sub-networks with shared parameters, and they process the frequency band energy feature sets in the activated state and non-activated state respectively;
[0017] Each sub-network adopts a deep convolutional neural network structure. It extracts local features through convolutional layers and enhances non-linear expression, compresses the feature dimension through a global average pooling layer, and then generates a latent representation through a fully connected layer;
[0018] Pair the frequency band energy feature sets in the activated state and non-activated state and input them into the siamese network, calculate the cosine similarity of the latent representations, and generate a similarity score through an exponential decay function;
[0019] Construct a contrast loss function to make the similarity of the latent representations of the same joint movement trajectory approach the maximum value, and the similarity of different trajectories is lower than a preset threshold;
[0020] After training is completed, generate the latent representations in the activated and non-activated states of each joint movement trajectory, calculate the difference vector, and dynamically adjust the weights according to the similarity score to generate a contrast representation to quantify the impact of device use on the joint movement trajectory.
[0021] In a preferred embodiment, step S3 includes the following content:
[0022] When processing the contrast representation, first define the usage frequency of the breathing trainer as an instrumental variable, which is calculated by counting the number of start and stop events of the physical switch per unit time, and divide the usage frequency into three levels: low frequency, medium frequency, and high frequency; then construct a causal forest model, use the contrast representation as the feature vector, the device usage state as the treatment variable, and the rehabilitation action effectiveness index as the outcome variable, and estimate the conditional average treatment effect by recursively partitioning the feature space; then perform counterfactual reasoning, estimate the prediction results of each sample in the activated and non-activated states of the device respectively, calculate the individual treatment effect, and aggregate the individual treatment effects of all samples to obtain the overall average treatment effect and the conditional distribution at different usage frequency levels; finally, use the SHAP method to evaluate the effectiveness of each sensor channel on the rehabilitation action, calculate the SHAP value of each dimension in the contrast representation, and take the average of the SHAP values of all samples to obtain the channel importance score of each sensor channel.
[0023] In a preferred embodiment, step S4 includes the following content:
[0024] The dynamic breathing resistance information includes the dynamic breathing resistance spectrum feature index; the joint movement information includes the joint movement spatio-temporal coordination index.
[0025] In a preferred embodiment, in S4.1, in order to characterize the spectral characteristics of the resistance change during the use of the breathing trainer, first, a low-frequency band energy distribution subset related to the breathing resistance is extracted from the frequency band energy feature set; then, wavelet packet decomposition is performed on the corresponding low-frequency band energy distribution subset until a preset number of layers is reached to obtain the energy spectra of each decomposition node; then, for each decomposition node of each layer, the proportion of the node energy of the corresponding layer in the total energy is calculated, and the contribution of the high-energy nodes is amplified through a preset adjustment parameter; at the same time, the entropy weight method is used to assign weights to each layer to highlight the frequency bands sensitive to the resistance change; finally, the weighted contributions of all layers are added together to obtain the dynamic breathing resistance spectral feature index.
[0026] In a preferred embodiment, in S4.2, in order to quantify the coordination of joint movement trajectories in time and space, first, the spatio-temporal features of the joint movement trajectories are extracted from the comparison characterization; then, the dynamic time warping method is used to calculate the trajectory matching degree of the joint movement trajectories in the activated and non-activated states of the device; then, for each time scale, the normalized value of the alignment cost of the joint movement trajectories at the corresponding scale is calculated and multiplied by the Pearson correlation coefficient in the corresponding spatial dimension; finally, the coordination contributions of all scales are averaged to obtain the joint movement spatio-temporal coordination index.
[0027] In a preferred embodiment, in S4.3-4, the dynamic breathing resistance spectral feature index, the joint movement spatio-temporal coordination index and the channel importance scores of each sensor channel are combined into a comprehensive feature vector and input into a pre-trained Transformer model, and the output result of the Transformer model is marked as the action effectiveness score; then, the base threshold and the complement value of the action effectiveness score are multiplied by an adjustment coefficient and added together; finally, according to the adjusted screening threshold, the channels with channel importance scores higher than the screening threshold are selected from the channel importance scores of each sensor channel, and the corresponding comparison characterizations are extracted to generate a pure characterization.
[0028] In a preferred embodiment, step S5 includes the following contents:
[0029] Extract the breathing waveform phase from the breathing waveform signal, and divide the pure characterization into multiple time domain groups according to the breathing waveform phase; perform frequency domain transformation on the pure characterization of each time domain group, perform weighted processing using the attention weights after normalization of the frequency band energy feature set, and then convert the weighted frequency domain characterization back to the time domain to obtain a weighted characterization; calculate the attention scores to perform weighted summation on the weighted characterizations of each time domain group to generate an intermediate characterization, and apply a global attention mechanism to the intermediate characterization to generate a final evaluation result.
[0030] A rehabilitation guidance system for thoracic surgery patients includes: a feature construction module, a trajectory similarity module, a channel contribution module, a feature screening module, and a grouping and fusion module;
[0031] Feature construction module: Based on the start and stop event trigger moments of the physical switch of the breathing trainer, determine the time anchors of the device activation period in the inertial sensor data stream, and extract the frequency band energy distribution of each axial accelerometer within a preset window before and after the time anchor to construct a frequency band energy feature set associated with device use;
[0032] Trajectory similarity module: Input the frequency band energy feature set into a siamese network, and calculate the similarity of the same joint movement trajectories in the device activation and non-activation states through contrastive learning to generate a contrastive representation of the compensatory action and the standard action;
[0033] Channel contribution module: Using the device usage frequency as an instrumental variable, adopt a causal forest model to perform counterfactual reasoning on the contrastive representation to obtain the channel importance scores of each sensor channel for the effectiveness of the rehabilitation action;
[0034] Feature screening module: Mine the key representations related to dynamic breathing resistance information and joint movement information, input them into a pre-trained model, adaptively adjust the screening threshold according to the values output by the model, and screen out the pure representations with channel importance scores higher than the adjusted threshold;
[0035] Grouping and fusion module: Perform time-domain grouping on the pure representations according to the breathing waveform phase, implement frequency-domain weighting with the frequency band energy as the attention weight, and generate the final evaluation result through hierarchical attention fusion.
[0036] The technical effects and advantages of a rehabilitation guidance system and method for thoracic surgery patients of the present invention:
[0037] Firstly, align the inertial sensor data stream based on the physical switch trigger timing, extract the anti-interference frequency band energy feature set through joint time-frequency domain analysis, effectively overcome the home environment noise interference, and ensure the high-fidelity capture of motion data; further construct a siamese network to compare the joint trajectory differences in the device enabled / disabled states, and accurately quantify the reconstruction intensity of the device-driven action on the motion pattern; use the device usage frequency as an instrumental variable to drive the causal forest model, analyze the causal relationship between each sensor channel and the rehabilitation effectiveness, synchronously fuse the dynamic spectrum of breathing resistance and the joint spatio-temporal coordination index, and screen out the confounding features through adversarial pre-training; finally, dynamically divide the time-domain feature clusters based on the breathing phase, and perform hierarchical fusion with the frequency band energy attention to generate an evaluation index with both time series sensitivity and pathological interpretability, realize the real-time closed-loop optimization of personalized training parameters, provide real-time and accurate decision support for the adjustment of personalized training plans, and thus significantly enhance the clinical applicability and practical value of the system. Brief Description of the Drawings
[0038] Figure 1 It is a schematic flowchart of a rehabilitation guidance method for thoracic surgery patients of the present invention.
[0039] Figure 2 This is a schematic structural diagram of a rehabilitation guidance system for thoracic surgery patients of the present invention. Specific embodiments
[0040] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
[0041] Embodiment 1: Figure 1 A rehabilitation guidance method for thoracic surgery patients of the present invention is given, including:
[0042] S1. Based on the triggering moment of the start-stop event of the physical switch of the breathing trainer, determine the time anchor of the instrument activation period in the inertial sensor data stream, and extract the frequency band energy distribution of each axial accelerometer within a preset window before and after the time anchor to construct a frequency band energy feature set related to the instrument use.
[0043] S2. Input the frequency band energy feature set into the siamese network, calculate the similarity of the same joint movement trajectory in the instrument activation and non-activation states through contrastive learning, and generate a contrastive representation of the compensatory action and the standard action.
[0044] S3. Using the instrument usage frequency as an instrumental variable, adopt the causal forest model to perform counterfactual reasoning on the contrastive representation, and obtain the channel importance score of each sensor channel for the effectiveness of the rehabilitation action.
[0045] S4. Mine the key representations related to the dynamic breathing resistance information and joint movement information, input them into the pre-trained model, adaptively adjust the screening threshold according to the value output by the model, and screen out the pure representations with a channel importance score higher than the adjusted threshold.
[0046] S5. Perform time-domain grouping on the pure representations according to the breathing waveform phase, implement frequency-domain weighting with the frequency band energy as the attention weight, and generate the final evaluation result through hierarchical attention fusion.
[0047] By analyzing the data streams of the breathing trainer and the inertial sensor, and combining the triggering moments of the start / stop events of the physical switch, the usage status of the device is analyzed, thereby providing a basis for evaluating the effectiveness of rehabilitation movements. In the rehabilitation training scenario, the breathing trainer is the core tool, and its usage status (activated or deactivated) is controlled by a physical switch, while the inertial sensor (such as an accelerometer) captures the multi-axial motion data (x, y, z-axis accelerations) of the device in real time. As the starting point of the entire analysis process, step S1 aims to extract the frequency band energy feature set related to device activation from the original inertial sensor data stream, laying a data foundation for subsequent steps (such as movement effectiveness evaluation).
[0048] Step S1 includes the following:
[0049] S1.1, Time anchor determination: First, the switch event needs to be detected. The specific method is to calculate the acceleration change amount between adjacent sampling points: for each moment in the data stream, calculate the difference between the three-axis acceleration vector at this moment and the three-axis acceleration vector at the previous moment, and then calculate the magnitude of this difference to obtain the magnitude of the acceleration change at this moment. Then, set an acceleration change threshold, such as a certain fixed value in units of meters per second squared. When the calculated change amount exceeds this threshold, it is initially considered that a switch action has occurred at this moment. After that, record the time points that meet this condition as candidate time points. If the device provides the specific time record of the switch event, use this time record to calibrate the candidate time points to ensure that the deviation of the finally determined time anchor from the actual switch action moment is within an acceptable range, such as less than one sampling period.
[0050] S1.2, Preset time window extraction: After determining the time anchor, a time window needs to be defined to extract data. The specific method is to set a time range centered on the time anchor so that the window covers equal time periods before and after the time anchor, such as a few seconds before and after, ensuring that the total length is sufficient to include the transition stage before and after device activation and at least one complete breathing cycle. Subsequently, intercept the three-axis acceleration data segment within this time window from the acceleration data stream, including the data in the horizontal, vertical, and vertical axes directions, to form a complete data segment for subsequent analysis.
[0051] S1.3, Band energy distribution extraction: Next, perform frequency-domain analysis on the three-axis acceleration data within the time window. First, perform fast Fourier transform on the acceleration data of the horizontal, vertical, and vertical axes respectively to convert the signal in the time domain into a signal in the frequency domain, obtaining the spectrum of each axis. Then, divide the frequency domain into several sub-bands, such as multiple intervals from zero to one hertz, one to two hertz, two to three hertz, etc. Next, calculate the energy of each band in each axis: for each band, sum the squares of the spectrum amplitudes of all frequency points within the band and then multiply by the frequency resolution, where the frequency resolution is the ratio of the sampling rate to the number of data points, to obtain the energy value of the band. To eliminate the influence of individual differences or sensor sensitivity, normalize the band energy of each axis. The specific method is to divide the energy value of each band by the sum of the energies of all bands of that axis to obtain the relative energy distribution.
[0052] S1.4, Constructing the band energy feature set: Finally, construct a feature set based on the band energy distribution. The specific method is to arrange the normalized energy values of the horizontal, vertical, and vertical axes in each band in sequence to form a feature vector. For example, first arrange the energy values of each band of the horizontal axis, then the vertical axis, and finally the vertical axis. If there are multiple time anchors corresponding to multiple switch operations, repeat the above steps for each time anchor, generate the corresponding feature vectors respectively, and these feature vectors can be stacked and combined into a feature matrix for subsequent analysis or modeling.
[0053] Through step S1, the time anchors corresponding to the start and stop events of the physical switch of the breathing trainer are accurately identified from the inertial sensor data stream, and the band energy distribution of the accelerometers on each axis within the preset window before and after the time anchor is calculated, successfully constructing a band energy feature set highly related to the usage state of the device. This feature set comprehensively depicts the motion characteristics during device activation, significantly improving the accuracy and reliability of rehabilitation motion analysis, and providing a solid data guarantee for the objective assessment of motion quality.
[0054] The usage state of the breathing trainer directly affects the execution quality of the joint motion trajectory and its contribution to the rehabilitation effect. Step S1 has determined the time anchors of the device activation period in the inertial sensor data stream based on the trigger moments of the start and stop events of the physical switch of the breathing trainer, and extracted the band energy distribution of the accelerometers on each axis within the preset window before and after the time anchor, constructing a band energy feature set related to device usage. This feature set characterizes the differences in motion characteristics between the activated and non-activated states of the device, laying a foundation for subsequent analysis. Step S2 aims to use this band energy feature set to accurately calculate the similarity of the same joint motion trajectory in the latent space between the activated and non-activated states of the device through the Siamese network architecture and contrast learning technology, generating a contrast representation of the compensatory action and the standard action, providing reliable input for the causal reasoning in step S3.
[0055] Step S2 includes the following:
[0056] S2.1, Construct a siamese network architecture: To process the band energy feature sets of the device in the active state and the non - active state, a siamese network architecture is designed. This architecture consists of two identical sub - networks that share the same parameters and are used to process the feature sets of the active state and the non - active state respectively. Each sub - network adopts a deep convolutional structure: In the first layer, the input feature set is scanned by a convolutional kernel to extract local feature information, and the activation function is used to enhance the non - linear expression ability of the features; in the second layer, the extracted features are further processed to obtain higher - level feature information, and then the spatial dimension of the features is compressed by a global average pooling layer to retain global information; finally, through the fully - connected layer, the processed features are mapped to a latent representation space to generate the latent representations of the active state and the non - active state respectively.
[0057] S2.2, Contrastive learning mechanism: During the contrastive learning process, the band energy feature sets of the active state and the non - active state are paired and input into the two sub - networks of the siamese network respectively to generate corresponding latent representations. Subsequently, the similarity between these two latent representations is calculated, and an exponential decay method based on cosine distance is used for measurement. The specific steps are as follows: First, calculate the cosine similarity of the two latent representations, that is, calculate the dot product of the two and then divide it by the product of their respective norms to obtain the similarity value; then, input the obtained cosine similarity value into an exponential decay function for transformation, so that the similarity value is restricted within the range of zero to one, where the value closer to one indicates that the two latent representations are more similar.
[0058] S2.3, Loss function: To optimize the training process of the siamese network, a contrastive loss function is constructed. The goal of this loss function is to make the similarity between the latent representations of the active state and the non - active state from the same joint motion trajectory close to 1, while making the similarity between the latent representations from different joint motion trajectories lower than a preset threshold. The specific implementation method is as follows: For each training sample pair, calculate the similarity score between its latent representation of the active state and the latent representation of the non - active state; according to whether the sample pair comes from the same joint motion trajectory, process the loss contributions of the positive sample pairs and the negative sample pairs respectively; for the positive sample pairs, make the similarity score approach 1 through a square term; for the negative sample pairs, make the similarity score less than the preset threshold through a truncated square term; the final contrastive loss function takes the average of the losses of all training sample pairs.
[0059] S2.4, Generation of contrastive representations: After the Siamese network is trained, for each joint movement trajectory, the frequency band energy feature sets in its active state and non-active state are input into the Siamese network to generate corresponding latent representations respectively. Subsequently, by calculating the difference between the latent representations corresponding to the active state and the non-active state, a difference vector is obtained, and the weight of the difference vector is dynamically adjusted according to the similarity score. The specific steps include: First, calculate the similarity score between the latent representation in the active state and the latent representation in the non-active state; then, use 1 minus this similarity score as the weight coefficient; finally, multiply the weight coefficient by the difference vector to generate the final contrastive representation. This contrastive representation is used to quantify the specific impact of device use on the execution of joint movement trajectories. The difference vector represents the representational difference of the same joint movement trajectory in the latent space between the activated and non-activated states of the device, and quantifies the impact of device use on the movement trajectory features.
[0060] The usage frequency of the breathing trainer directly affects the effectiveness of the rehabilitation action, and the inertial sensor data stream provides a quantitative basis for action execution. In step S2, a contrastive representation of the compensatory action and the standard action is generated through the Siamese network, which quantifies the latent difference of the joint movement trajectory between the activated and non-activated states of the device. Step S3 aims to use the causal forest model, with the usage frequency of the device as an instrumental variable, to perform counterfactual reasoning on the contrastive representation, obtain the channel importance scores of each sensor channel for the effectiveness of the rehabilitation action, and provide accurate input for screening key representations in step S4.
[0061] Step S3 includes the following:
[0062] S3.1, Definition of instrumental variable: To identify the causal effect of breathing trainer use on the effectiveness of the rehabilitation action, the usage frequency of the breathing trainer is defined as the instrumental variable. This usage frequency is calculated by counting the number of start-stop events of the physical switch per unit time to ensure its association with the action execution quality and at the same time not being interfered by unobserved confounding factors. To adapt to the classification requirements of the causal forest model and facilitate subsequent effect estimation, the usage frequency is divided into three levels: low frequency, medium frequency, and high frequency, and the specific division is based on a preset number threshold.
[0063] S3.2, Construction of the causal forest model: To handle the causal relationship in the high-dimensional feature space, a causal forest model is adopted to estimate the conditional average treatment effect by integrating multiple causal trees. The specific construction process is as follows: Take the contrastive representation generated in step S2 as the feature vector, the device usage state (divided into two states: activated and non-activated) as the treatment variable, and the rehabilitation action effectiveness index as the outcome variable. The causal forest model estimates the impact of the treatment variable on the outcome variable in different subspaces by recursively partitioning the feature space, that is, the magnitude of the effect of device use on the effectiveness of the rehabilitation action under the given feature vector.
[0064] S3.3, Counterfactual reasoning: Use the causal forest model for counterfactual reasoning to estimate the differences in the effectiveness of rehabilitation actions under different usage frequencies. The specific steps are as follows: For each sample, estimate its prediction results in the activated state and non-activated state of the device respectively; then, calculate the individual treatment effect, that is, the difference between the prediction results in the activated state and the non-activated state; finally, aggregate the individual treatment effects of all samples, calculate the overall average treatment effect, and further analyze the conditional distribution at three usage frequency levels of low frequency, medium frequency, and high frequency, as the basis for subsequent channel importance score analysis.
[0065] S3.4, Obtaining the channel importance scores of sensor channels: Use the SHAP method to evaluate the importance of each dimension in the contrastive representation. The specific implementation process is as follows: Consider each dimension of the contrastive representation as an independent feature, and calculate the contribution value of this feature to the model output, called the SHAP value, by comparing the treatment effect differences when this feature is included and not included; then, take the average of the SHAP values of all samples to obtain the channel importance scores of each sensor channel, and use them as the final output results.
[0066] In step S3, using the device usage frequency as an instrumental variable, counterfactual reasoning is performed on the contrastive representation generated in step S2 through the causal forest model, and the channel importance scores of each sensor channel for the effectiveness of rehabilitation actions are successfully generated. These channel importance scores precisely quantify the roles of different sensor channels in evaluating the action effectiveness, providing a reliable basis for mining the key representations related to dynamic breathing resistance information and joint movement information in step S4, and ensuring the pertinence and accuracy of the subsequent screening process.
[0067] Step S4 includes the following content:
[0068] The dynamic breathing resistance information includes the dynamic breathing resistance spectrum feature index;
[0069] The joint movement information includes the joint movement spatio-temporal coordination index.
[0070] The dynamic respiratory resistance spectrum feature index is used to reflect the spectral characteristics of the resistance change during the use of the respiratory trainer. By analyzing the energy distribution of the respiratory resistance in the frequency domain, the stability of the respiratory rhythm and the dynamic characteristics of the resistance change are quantified. The larger the value, the higher the energy concentration of the respiratory resistance in a specific frequency band, indicating enhanced stability of the respiratory rhythm. Conversely, the smaller the value, the more dispersed or unstable the respiratory resistance change. The joint movement spatio-temporal coordination index is used to represent the coordination of joint movement trajectories in time and space. By evaluating the alignment degree of joint movement trajectories in the activated and non-activated states of the device, the coordination and consistency of movement are quantified. The larger the value, the higher the alignment degree of joint movement trajectories in different states and the better the coordination. Conversely, the smaller the value, the greater the spatio-temporal deviation of the movement trajectory. The purpose of calculating these two indices is to comprehensively characterize the execution quality of rehabilitation movements from two dimensions: the frequency domain and the spatio-temporal domain, providing high-quality feature inputs to improve the evaluation accuracy and robustness of the pre-trained model for the effectiveness of movements. At the same time, the introduction of these two indices helps to deeply understand the impact of respiratory resistance change and joint movement coordination on the rehabilitation effect, providing data support for optimizing the rehabilitation training plan. The advantage is that it can more accurately evaluate the effect of movement execution and guide training improvement.
[0071] S4.1, Dynamic respiratory resistance spectrum feature index: To characterize the spectral characteristics of the resistance change during the use of the respiratory trainer, first, extract the low-frequency band energy distribution subset related to the respiratory resistance from the frequency band energy feature set, specifically focusing on the frequency band reflecting the respiratory rhythm characteristics. Then, perform wavelet packet decomposition on this low-frequency band energy distribution subset to the preset number of layers to obtain the energy spectra of each decomposition node. Next, calculate the dynamic respiratory resistance spectrum feature index. The specific method is as follows: For each layer of decomposition nodes, calculate the proportion of the node energy in this layer to the total energy, and amplify the contribution of high-energy nodes through a preset adjustment parameter; at the same time, use the entropy weight method to assign weights to each layer to highlight the frequency bands sensitive to resistance change; finally, sum up the weighted contributions of all layers to obtain the dynamic respiratory resistance spectrum feature index. For example, the acquisition process is as follows:
[0072] Extract the frequency band energy subset related to the respiratory resistance from the frequency band energy feature set in step S1, focusing on the energy distribution in the low-frequency band (e.g., 0 - 2 Hz) to reflect the respiratory rhythm characteristics. Perform wavelet packet decomposition on the frequency band energy subset to the 3rd layer to obtain the energy spectra of each node. Calculate the dynamic respiratory resistance spectrum feature index , using the following formula:
[0073]
[0074] The number of layers of wavelet packet decomposition, set to 3.
[0075] : The The weight coefficient of the layer is calculated by the entropy weight method, which highlights the frequency bands sensitive to resistance changes based on the information entropy of the energy distribution of each layer of nodes.
[0076] : The energy value of the th wavelet packet node, extracted from the frequency band energy subset.
[0077] The total number of wavelet packet nodes.
[0078] : The adjustment parameter, set to 1.5, is used to amplify the contribution of high-energy nodes.
[0079] S4.2, Joint Motion Spatiotemporal Synergy Index: To quantify the synergy of joint motion trajectories in time and space, first extract the spatiotemporal features of joint motion trajectories from the comparison representation. Then, use the dynamic time warping method to calculate the trajectory matching degree of joint motion trajectories in the activated and non-activated states of the instrument. Next, introduce multi-scale analysis to evaluate the synergy at different time scales and spatial dimensions. The specific calculation method is as follows: for each time scale, calculate the normalized value of the trajectory matching degree of the joint motion trajectory at this scale and multiply it by the Pearson correlation coefficient of the corresponding spatial dimension; finally, take the average of the synergy contributions of all scales to obtain the joint motion spatiotemporal synergy index. For example, the acquisition process is as follows:
[0080] Extract the spatiotemporal features of joint motion trajectories from the comparison representation and use the dynamic time warping (DTW) method to calculate the trajectory matching degree of the trajectories in the activated and non-activated states of the instrument Introduce multi-scale analysis and calculate the synergy at different time scales and spatial dimensions using the following formula:
[0081]
[0082] The number of time scales, set to 3 (short, medium, and long scales).
[0083] : The DTW alignment cost at the th time scale, calculated based on calculation.
[0084] : The maximum alignment cost at the th scale, used for normalization.
[0085] : The Pearson correlation coefficient of the th spatial dimension, calculated based on the spatial features of the comparison representation, reflecting the spatial synergy.
[0086] S4.3. Combine the calculated dynamic respiratory resistance spectrum feature index, joint movement spatio-temporal coordination index, and the channel importance scores of each sensor channel to form a comprehensive feature vector, which serves as the input to the pre-trained model.
[0087] S4.4. Use a Transformer model pre-trained on a large-scale rehabilitation movement dataset to learn the deep representation of movement effectiveness. Input the comprehensive feature vector into this pre-trained model, and mark the output result of the Transformer model as the movement effectiveness score. Dynamically adjust the screening threshold according to this movement effectiveness score. The specific method is as follows: Multiply the base threshold by the complementary value of the movement effectiveness score (i.e., 1 minus the movement effectiveness score) and then add them together through an adjustment coefficient to obtain the adaptively adjusted screening threshold.
[0088] S4.5. According to the adjusted screening threshold, screen out the channels with channel importance scores higher than the screening threshold from each sensor channel, and extract the corresponding contrast representations of these channels to generate pure representations.
[0089] In step S4, the dynamic respiratory resistance spectrum feature index is calculated through wavelet packet decomposition and the entropy weight method, the joint movement spatio-temporal coordination index is calculated by combining DTW and multi-scale analysis, and the screening threshold is adaptively adjusted based on the comprehensive feature vector and the pre-trained model. The finally screened pure representations accurately reflect the sensor channel information highly correlated with the effectiveness of rehabilitation movements, providing high-quality input for the time-domain grouping and frequency-domain weighting in step S5, ensuring the accuracy and reliability of the evaluation results.
[0090] As the final step of the entire process, the goal of step S5 is to perform time-domain grouping on the pure representations screened in step S4 according to the respiratory waveform phase, and implement frequency-domain weighting with the frequency band energy feature set extracted in step S1 as the attention weights. Generate the final evaluation result through hierarchical attention fusion to provide a comprehensive evaluation of the effectiveness of rehabilitation movements.
[0091] Step S5 includes the following:
[0092] S5.1. Characterize the periodic features of the respiratory movement. First, obtain the original respiratory waveform signal from the pressure sensor or flow sensor of the respiratory trainer, and this signal changes continuously over time. Then, apply the Hilbert transform to the original respiratory waveform signal to generate an analytic signal, which is composed of the original respiratory waveform signal and the result of its Hilbert transform. Then, by calculating the arctangent of the ratio of the imaginary part to the real part of the analytic signal, obtain the respiratory waveform phase. The value range of the respiratory waveform phase is from negative π to π, reflecting the periodic changes in the inhalation and exhalation phases of the respiratory movement.
[0093] S5.2. Capture the characteristics of different breathing phases, and divide the pure representation into multiple time-domain groups according to the breathing waveform phase. First, divide a breathing cycle into several phase segments, such as the initial stage of inhalation, the peak of inhalation, the initial stage of exhalation, and the peak of exhalation, etc. Each phase segment corresponds to a specific phase range. Then, for each time point in the pure representation, according to the value of its breathing waveform phase, the corresponding pure representation is assigned to the time-domain group of the corresponding phase segment.
[0094] S5.3. To perform frequency-domain weighting on each time-domain group, first perform a fast Fourier transform on the pure representation of each time-domain group to obtain its frequency-domain representation. Then, normalize the frequency-band energy feature set into attention weights to ensure that the sum of all attention weights is 1. Then, multiply the frequency-domain representation element-wise by the attention weights to obtain the weighted frequency-domain representation. Finally, convert the weighted frequency-domain representation back to the time domain through an inverse fast Fourier transform to obtain the weighted representation.
[0095] S5.4. To fuse the weighted representations of each time-domain group and generate the final evaluation result, a hierarchical attention mechanism is adopted. First, calculate the attention scores for each weighted representation. The specific method is as follows: linearly transform the weighted representation through a learnable transformation matrix, then process it through the tanh activation function, then multiply it by a learnable attention vector, and finally normalize it through the softmax function to obtain the importance weights of each time-domain group. Then, based on these importance weights, perform a weighted sum of the weighted representations of all time-domain groups to obtain an intermediate representation, which synthesizes the characteristics of each breathing phase. Finally, apply a global attention mechanism to the intermediate representation. The specific method is as follows: linearly transform the intermediate representation through a learnable global transformation matrix, then process it through the tanh activation function, then multiply it by a learnable global attention vector, normalize it through the softmax function and multiply it by the intermediate representation to obtain the final evaluation result. The final evaluation result is a scalar or vector representing the comprehensive evaluation value of the effectiveness of the rehabilitation action.
[0096] The calculation of the attention score involves the following steps:
[0097] 1. Feature transformation: Linearly transform the input data (such as the weighted representation of a certain time-domain group ) through a learnable transformation matrix and introduce a non-linear activation function (such as ) to generate a new feature representation.
[0098] 2. Similarity calculation: Use a learnable vector to calculate the similarity between this feature representation and the query or context through methods such as dot product.
[0099] 3. Normalization: Convert the calculated similarity into a probability distribution form through the softmax function to obtain the attention scores. , ensuring that the sum of all scores is 1.
[0100] The specific formula is: ;
[0101] where, represents the attention score of the th time domain group.
[0102] In step S5, the pure representation obtained in step S4 is grouped in the time domain according to the respiratory waveform phase, the frequency band energy feature set in step S1 is used as the attention weight to perform frequency domain weighting, and the final evaluation result is generated through a hierarchical attention fusion mechanism. This result comprehensively integrates the spatio-temporal information of the respiratory cycle characteristics, the device usage status, and the joint movement trajectory, providing an accurate and comprehensive evaluation of the effectiveness of the rehabilitation action and supporting the optimized application of the respiratory trainer in rehabilitation training.
[0103] Embodiment 2: Figure 2 A rehabilitation guidance system for thoracic surgery patients according to the present invention is provided, including:
[0104] A feature construction module, a trajectory similarity module, a channel contribution module, a feature screening module, and a grouping and fusion module;
[0105] Feature construction module: Based on the start and stop event trigger moments of the physical switch of the respiratory trainer, determine the time anchors of the device activation period in the inertial sensor data stream, and extract the frequency band energy distribution of each axial accelerometer within a preset window before and after the time anchor to construct a frequency band energy feature set related to device usage;
[0106] Trajectory similarity module: Input the frequency band energy feature set into a siamese network, calculate the similarity of the same joint movement trajectory in the device activation and non-activation states through contrastive learning, and generate a contrastive representation of the compensatory action and the standard action;
[0107] Channel contribution module: Using the device usage frequency as an instrumental variable, perform counterfactual reasoning on the contrastive representation using a causal forest model to obtain the channel importance scores of each sensor channel for the effectiveness of the rehabilitation action;
[0108] Feature screening module: Mine the key representations related to dynamic respiratory resistance information and joint movement information, input them into a pre-trained model, adaptively adjust the screening threshold according to the value output by the model, and screen out the pure representations with channel importance scores higher than the adjusted threshold;
[0109] Group fusion module: Perform time-domain grouping on the pure representation according to the respiratory waveform phase, implement frequency-domain weighting with the band energy as the attention weight, and generate the final evaluation result through hierarchical attention fusion.
[0110] All the above formulas are dimensionless and take their numerical values for calculation. The formulas are obtained by collecting a large amount of data for software simulation to get a formula closest to the real situation. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0111] It should be noted that the system of the present invention can be deployed on the device itself to achieve embedded applications, or can also run on a PC or other terminals with a user interface, so as to meet various hardware environments and usage requirements.
[0112] Only some exemplary embodiments of the present invention have been described by way of illustration above. Undoubtedly, for those of ordinary skill in the art, without departing from the spirit and scope of the present invention, the described embodiments can be modified in various different ways. Therefore, the above drawings and description are illustrative in nature and should not be construed as limiting the protection scope of the claims of the present invention.
[0113] It should be noted that in this article, if there are relational terms such as first and second, they are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.
[0114] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for guiding rehabilitation of thoracic surgery patients, characterized in that: Includes steps: S1. Based on the start and stop event triggering moment of the physical switch of the breathing trainer, determine the time anchor point of the device activation period in the inertial sensor data stream, extract the frequency band energy distribution of each axial accelerometer in the preset window before and after the time anchor point, and construct the frequency band energy feature set associated with the use of the device; S2. Input the frequency band energy feature set into the twin network, calculate the similarity of the motion trajectory of the same joint under the activation and inactivation states of the device through comparative learning, and generate comparative representations of compensatory actions and standard actions; S3. Using the frequency of device use as an instrumental variable, the causal forest model was used to perform counterfactual reasoning on the contrast representation to obtain the channel importance score of each sensor channel for the effectiveness of rehabilitation movements; S4. Mining key representations related to dynamic respiratory resistance information and joint motion information, inputting them into the pre-trained model, adaptively adjusting the screening threshold according to the numerical value output by the model, and screening out pure representations whose channel importance scores are higher than the adjusted threshold; S5. The pure representations are grouped in the time domain according to the phase of the respiratory waveform, and the frequency domain weighting is performed using the frequency band energy as the attention weight, and the final evaluation result is generated through hierarchical attention fusion.
2. A method for guiding rehabilitation of thoracic surgery patients according to claim 1, characterized in that: Step S1 includes the following contents: By analyzing the triggering moment of the start and stop events of the physical switch of the breathing trainer and combining it with the acceleration changes in the inertial sensor data stream, the moment of device state switching is located, and the three-axis acceleration data in the preset time windows before and after are extracted based on this. Subsequently, the acceleration data in the corresponding time window is subjected to a fast Fourier transform to convert the time domain signal into a frequency domain signal, and the frequency domain is divided into multiple sub-bands. Then, for each sub-band, the energy of each axis is calculated and normalized to obtain the relative energy distribution. Finally, the normalized energy values of each sub-band of each axis are arranged in order to construct a feature vector as a frequency band energy feature set associated with the use of the device.
3. A method for guiding rehabilitation of thoracic surgery patients according to claim 2, characterized in that: Step S2 includes the following contents: When processing the frequency band energy feature sets in the activated state and the inactivated state of the device, a twin network architecture is constructed, which includes two parameter-sharing sub-networks to process the frequency band energy feature sets in the activated state and the inactivated state respectively; Each sub-network adopts a deep convolutional neural network structure, extracts local features and enhances nonlinear expression through the convolution layer, compresses feature dimensions through the global average pooling layer, and then generates potential representation through the fully connected layer; Pair the frequency band energy feature sets of the activated state and the inactivated state into the twin network, calculate the cosine similarity of the latent representation, and generate a similarity score through an exponential decay function; Construct a contrast loss function so that the similarity of the potential representation of the same joint motion trajectory approaches the maximum value, and the similarity of different trajectories is lower than the preset threshold; After training is completed, the activation and inactivation state latent representations of each joint motion trajectory are generated. The difference vector is obtained by calculating the difference between the activation and inactivation state latent representations, and the weight is dynamically adjusted according to the similarity score to generate a comparative representation to quantify the impact of device use on the joint motion trajectory.
4. A method for guiding rehabilitation of thoracic surgery patients according to claim 3, characterized in that: Step S3 includes the following contents: When processing the contrast representation, the frequency of use of the breathing trainer is first defined as an instrumental variable, which is calculated by counting the number of start and stop events of the physical switch per unit time, and the frequency of use is divided into three levels: low frequency, medium frequency and high frequency. Then, a causal forest model is constructed, with the contrast representation as the feature vector, the device usage status as the treatment variable, and the rehabilitation action effectiveness index as the outcome variable. The conditional average treatment effect is estimated by recursively partitioning the feature space. Then, counterfactual reasoning is performed to estimate the prediction results of each sample in the device activation and inactivation states, calculate the individual treatment effect, and aggregate the individual treatment effects of all samples to obtain the overall average treatment effect and the conditional distribution under different usage frequency levels. Finally, the SHAP method is used to evaluate the effectiveness of each sensor channel on the rehabilitation action, calculate the SHAP value of each dimension in the contrast representation, and average the SHAP values of all samples to obtain the channel importance score of each sensor channel.
5. A method for guiding rehabilitation of thoracic surgery patients according to claim 4, characterized in that: Step S4 includes the following contents: The dynamic respiratory resistance information includes a dynamic respiratory resistance spectrum characteristic index; The joint motion information includes the spatiotemporal synergy index of joint motion.
6. A method for guiding rehabilitation of thoracic surgery patients according to claim 5, characterized in that: Step S4 also includes the following contents: S4.1, in order to characterize the spectral characteristics of the resistance change of the breathing trainer during use, firstly, the low-frequency energy distribution subset related to the breathing resistance is extracted from the frequency band energy feature set; then, the corresponding low-frequency energy distribution subset is decomposed into a preset number of layers by wavelet packet decomposition to obtain the energy spectrum of each decomposition node; then, for the decomposition nodes of each layer, the proportion of the energy of the corresponding layer nodes to the total energy is calculated, and the contribution of the high-energy nodes is amplified by the preset adjustment parameters; at the same time, the entropy weight method is used to assign weights to each layer to highlight the frequency bands that are sensitive to resistance changes; finally, the weighted contributions of all layers are added together to obtain the dynamic breathing resistance spectrum characteristic index.
7. A method for guiding rehabilitation of thoracic surgery patients according to claim 5, characterized in that: Step S4 also includes the following contents: S4.2, in order to quantify the temporal and spatial synergy of joint motion trajectories, the spatiotemporal features of joint motion trajectories are first extracted from the contrast representation; then, the dynamic time warping method is used to calculate the trajectory matching degree of joint motion trajectories under the device activation and inactivation states; then, for each time scale, the normalized value of the joint motion trajectory alignment cost at the corresponding scale is calculated and multiplied by the Pearson correlation coefficient of the corresponding spatial dimension; finally, the synergy contribution of all scales is averaged to obtain the spatiotemporal synergy index of joint motion.
8. A method for guiding rehabilitation of thoracic surgery patients according to claim 5, characterized in that: S4.3-4, the dynamic respiratory resistance spectrum feature index, the spatiotemporal coordination index of joint movement and the channel importance score of each sensor channel are combined into a comprehensive feature vector, which is input into the pre-trained Transformer model, and the output result of the Transformer model is marked as the action effectiveness score; then, the basic threshold and the complement of the action effectiveness score are multiplied by the adjustment coefficient and added together, where the complement of the action effectiveness score is 1 minus the action effectiveness score; finally, according to the adjusted screening threshold, the channels with a higher value than the screening threshold are screened out from the channel importance scores of each sensor channel, and the corresponding contrast representation is extracted to generate a pure representation.
9. A method for guiding rehabilitation of thoracic surgery patients according to claim 8, characterized in that: Step S5 includes the following contents: The respiratory waveform phase is extracted from the respiratory waveform signal, and the pure representation is divided into multiple time domain groups according to the respiratory waveform phase; the pure representation of each time domain group is transformed into the frequency domain, and weighted processing is performed using the attention weight normalized by the frequency band energy feature set, and then the weighted frequency domain representation is converted back to the time domain to obtain a weighted representation; the weighted representation of each time domain group is weightedly summed by calculating the attention score to generate an intermediate representation, and the global attention mechanism is applied to the intermediate representation to generate the final evaluation result.
10. A thoracic surgery patient rehabilitation guidance system, used to implement a thoracic surgery patient rehabilitation guidance method according to any one of claims 1 to 9, characterized in that: include: Feature construction module, trajectory similarity module, channel contribution module, feature screening module, grouping fusion module; Feature construction module: Based on the start and stop event triggering moment of the breathing trainer physical switch, the time anchor point of the device activation period is determined in the inertial sensor data stream, and the frequency band energy distribution of each axial accelerometer in the preset window before and after the time anchor point is extracted to construct the frequency band energy feature set associated with the use of the device; Trajectory similarity module: The frequency band energy feature set is input into the twin network, and the similarity of the motion trajectory of the same joint in the activated and inactivated states of the device is calculated through comparative learning, generating comparative representations of compensatory actions and standard actions; Channel contribution module: using the frequency of device use as an instrumental variable, the causal forest model is used to perform counterfactual reasoning on the comparative representation to obtain the channel importance score of each sensor channel for the effectiveness of rehabilitation movements; Feature screening module: It mines key representations related to dynamic respiratory resistance information and joint motion information, inputs them into the pre-trained model, and adaptively adjusts the screening threshold according to the numerical value output by the model to screen out pure representations whose channel importance scores are higher than the adjusted threshold; Grouping fusion module: The pure representations are grouped in the time domain according to the phase of the respiratory waveform, and frequency domain weighting is performed using the frequency band energy as the attention weight, and the final evaluation result is generated through hierarchical attention fusion.
Citation Information
Patent Citations
Portable knee joint postoperative rehabilitation training monitoring and evaluating device and method
CN117137479A
Rehabilitation bicycle training method and system based on motor imagery
CN117493801A