Gait recognition method and device based on myoelectricity and inertial data fusion
By synchronously processing electromyographic and inertial data streams and analyzing the phase state transition model, the problem of insufficient feature correlation in gait recognition was solved, and high-precision gait recognition was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-28
- Publication Date
- 2026-04-10
AI Technical Summary
Existing gait recognition methods are unable to accurately reflect the intrinsic temporal coordination between electromyographic activity and limb movement, resulting in limited accuracy of gait recognition results and failing to meet the needs of refined analysis.
By acquiring electromyography (EMG) and inertial data streams, aligning the acquisition time axis and filtering signal quality, identifying gait event trigger points, generating a set of gait cycle units, extracting the envelope features of EMG signals and the attitude angle change sequence of inertial signals, performing correlation analysis, calling the gait phase state transition model to perform phase transition path inference, and calculating structural similarity to determine the gait category.
It significantly improves the accuracy and precision of gait recognition, and solves the problems of insufficient feature correlation and loss of temporal dynamic information in conventional fusion recognition methods.
Smart Images

Figure CN121817865A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data processing, and particularly relates to a gait recognition method and device based on electromyography and inertial data fusion. BACKGROUND
[0002] As an important branch of biometric recognition, gait recognition technology realizes the distinction of gait features of different individuals and the classification of different gait types by analyzing the motion patterns and muscle activity characteristics of individuals in the walking process. At present, the electromyography signals of lower limb muscles and the inertial motion signals of limbs are synchronously collected during the walking process of the subjects, the statistical features in the time domain or frequency domain are extracted from the electromyography signals, the kinematic parameters such as acceleration and angular velocity are extracted from the inertial signals, then the two types of features extracted are combined or spliced and input into a classifier, and the classifier outputs the corresponding gait category result according to the combined feature vector. This recognition method of simply combining the features extracted respectively often cannot accurately reflect the internal time sequence coordination relationship between electromyography activity and limb motion, resulting in that the accuracy of the final gait recognition result is limited, and the actual demand of fine gait analysis cannot be met. SUMMARY
[0003] The present application provides a gait recognition method and device based on electromyography and inertial data fusion.
[0004] In a first aspect, embodiments of the present invention provide a gait recognition method based on the fusion of electromyography (EMG) and inertial data, comprising: acquiring raw EMG signal streams collected by an EMG sensor and raw inertial signal streams collected by an inertial sensor; performing time axis alignment processing on the raw EMG and raw inertial signal streams to eliminate time delay differences, and performing signal quality screening processing to remove signal segments whose signal quality does not meet preset requirements, thereby obtaining a synchronized EMG-inertial data stream; performing gait event trigger point detection on the synchronized EMG-inertial data stream, identifying heel strike event points and toe lift-off event points in the gait cycle, and segmenting the synchronized EMG-inertial data stream according to the heel strike event points and toe lift-off event points to generate a set of gait cycle units based on gait cycles; extracting envelope features from the EMG signal segments contained in each gait cycle unit in the set of gait cycle units, and extracting posture angle change sequences from the contained inertial signal segments, thereby extracting the envelope features of the EMG signal segments. A correlation analysis is performed with the attitude angle change sequence of the inertial signal segment to obtain the electromyographic-inertial coupling activation pattern descriptor, which reflects the cooperative relationship between electromyographic activity and inertial motion. A pre-built gait phase state transition model is invoked to infer the phase transition path of the electromyographic-inertial coupling activation pattern descriptor. The gait phase state transition model is configured with a time recursive structure, generating the phase state nodes that appear successively within the gait cycle and the transition directions between phase state nodes based on the time evolution trend of the electromyographic-inertial coupling activation pattern descriptor, thus obtaining the phase state transition path topology. The structural similarity of the phase state transition path topology with multiple reference path topologies in the pre-set gait pattern library is calculated. The gait category label corresponding to the reference path topology with the highest similarity is selected as the gait category label of the current gait. The phase offset is determined based on the node phase offset between the phase state transition path topology and the reference path topology, and the gait recognition result containing the gait category label and the phase offset is output.
[0005] Secondly, embodiments of the present invention provide a gait recognition device, comprising: a data acquisition module, configured to acquire raw electromyographic signal streams collected by an electromyographic sensor and raw inertial signal streams collected by an inertial sensor, perform time axis alignment processing on the raw electromyographic signal streams and raw inertial signal streams to eliminate time delay differences, and perform signal quality screening processing to remove signal segments whose signal quality does not meet preset requirements, thereby obtaining a synchronized electromyographic-inertial data stream; an event detection module, configured to detect gait event trigger points in the synchronized electromyographic-inertial data stream, identify heel strike event points and toe lift event points in the gait cycle, and segment the synchronized electromyographic-inertial data stream according to the heel strike event points and toe lift event points, generating a set of gait cycle units based on gait cycles; and a feature extraction module, configured to extract envelope features from the electromyographic signal segments contained in each gait cycle unit in the set of gait cycle units, and extract posture angle change sequences from the contained inertial signal segments, and combine the envelope features of the electromyographic signal segments with... The attitude angle change sequence of inertial signal segments is correlated to obtain an electromyographic-inertial coupling activation pattern descriptor reflecting the cooperative relationship between electromyographic activity and inertial motion. A topology generation module is used to call a pre-built gait phase state transition model to infer the phase transition path of the electromyographic-inertial coupling activation pattern descriptor. The gait phase state transition model is configured with a time recursive structure, generating phase state nodes that appear successively within the gait cycle and the transition directions between phase state nodes based on the temporal evolution trend of the electromyographic-inertial coupling activation pattern descriptor, thus obtaining the phase state transition path topology. A gait recognition module is used to perform structural similarity calculations between the phase state transition path topology and multiple reference path topologies in a pre-set gait pattern library. The gait category label corresponding to the reference path topology with the highest similarity is selected as the gait category label for the current gait. The phase offset is determined based on the node phase offset between the phase state transition path topology and the reference path topology, and the gait recognition result containing the gait category label and the phase offset is output.
[0006] The embodiments of this application have the following beneficial effects: By acquiring the raw electromyographic (EMG) signal stream and the raw inertial signal stream, the acquisition time axis is aligned and the signal quality is filtered to obtain a synchronized EMG-inertial data stream; then, gait event trigger point detection is performed on the synchronized data stream to identify heel strike event points and toe lift-off event points, and based on this, a set of gait cycle units is generated with gait cycles as the unit; then, envelope feature extraction is performed on the EMG signal segments in each gait cycle unit, and posture angle change sequence extraction is performed on the inertial signal segments, and the two are correlated to obtain an EMG-inertial coupling activation mode descriptor reflecting the synergistic relationship between EMG activity and inertial motion; then, the gait phase state transition model is called to perform phase transition path reasoning on the descriptor to generate phase state nodes that appear successively within the gait cycle and the transition direction between nodes, forming a phase state transition path topology; finally, the structural similarity calculation is performed between this topology and the reference path topology in the gait pattern library, the gait category label corresponding to the reference path topology with the highest similarity is selected, and the phase offset is determined according to the node phase offset, and the gait recognition result containing the gait category label and the phase offset is output. This invention effectively solves the problems of insufficient feature correlation and loss of temporal dynamic information in conventional fusion recognition methods through the above-mentioned interconnected processing flow, and significantly improves the accuracy and precision of gait recognition. Attached Figure Description
[0007] Figure 1 This is a schematic diagram of the architecture of the application scenario provided in the embodiments of this application; Figure 2 This is a schematic diagram of the structure of the computer system provided in the embodiments of this application; Figure 3 This is a flowchart illustrating the gait recognition method based on the fusion of electromyography and inertial data provided in the embodiments of this application. Detailed Implementation
[0008] In the following description, references to "some embodiments" describe a subset of all possible embodiments. However, it is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without conflict. In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit the application.
[0009] See Figure 1 , Figure 1 This is a schematic diagram of the application scenario provided in the embodiments of this application. The sensor 400 is connected to the computer system 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two, and data transmission is achieved using wireless or wired links.
[0010] The sensor 400 is divided into an electromyography (EMG) sensor and an inertial sensor. The EMG sensor collects raw EMG signal streams, and the inertial sensor collects raw inertial signal streams. The collected signals are sent to the computer system 200. The computer system 200 is used to execute the gait recognition method based on the fusion of EMG and inertial data provided in this embodiment of the invention based on the acquired signals.
[0011] In some embodiments, the computer system 200 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Furthermore, it can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these.
[0012] The following describes a computer system implementing the gait recognition method based on electromyography and inertial data fusion provided in the embodiments of this application. See also Figure 2 , Figure 2 This is a schematic diagram of the structure of the computer system provided in the embodiments of this application. Figure 2 The computer system shown includes at least one processor 210, memory 250, at least one network interface 220, and an external interface 230. The various components in the computer system 200 are coupled together via a bus system 240. It is understood that the bus system 240 is used to implement communication between these components. In addition to a data bus, the bus system 240 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 240.
[0013] Processor 210 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0014] External interface 230 may include, for example, one or more speakers and / or one or more visual displays. External interface 230 may also include one or more input devices 432, such as a keyboard, mouse, microphone, touch screen display, camera, etc.
[0015] The memory 250 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 250 may optionally include one or more storage devices physically located away from the processor 210.
[0016] The memory 250 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 250 described in this application embodiment is intended to include any suitable type of memory.
[0017] In some embodiments, memory 250 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0018] Operating system 251 includes system programs for handling various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; network communication module 252 is used to reach the sensor via one or more (wired or wireless) network interfaces 220, exemplary network interfaces 220 include: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.; presentation module 253 is used to enable the display of information (e.g., external interfaces for operating peripheral devices and displaying content and information) via one or more output devices 231 associated with external interface 230 (e.g., display screen, speaker, etc.); input processing module 254 is used to detect and translate one or more user inputs or interactions from one or more input devices 232.
[0019] In some embodiments, the apparatus provided in this application can be implemented in software. Figure 2A gait recognition device 255 stored in memory 250 is shown. This device can be software in the form of programs or plug-ins, and includes the following software modules: a data acquisition module 2551, an event detection module 2552, a feature extraction module 2553, a topology generation module 2554, and a gait recognition module 2555. These modules are logically connected and can therefore be arbitrarily combined or further separated according to their implemented functions. The functions of each module will be described below.
[0020] In other embodiments, the apparatus provided in this application can be implemented in hardware. As an example, the skill release device in the virtual scene provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the gait recognition method based on electromyography and inertial data fusion provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0021] Based on the above description of the application scenarios and computer systems provided in the embodiments of this application, the gait recognition method based on the fusion of electromyography (EMG) and inertial data provided in the embodiments of this application is described below. In actual implementation, the gait recognition method based on the fusion of EMG and inertial data provided in the embodiments of this application can be implemented by a computer system. See also... Figure 3 , Figure 3 This is a flowchart illustrating the gait recognition method based on the fusion of electromyography and inertial data provided in this application embodiment. Next, we will combine... Figure 3 The steps shown are explained.
[0022] Step S100: Acquire the raw electromyographic signal stream collected by the electromyographic sensor and the raw inertial signal stream collected by the inertial sensor. Perform time axis alignment processing on the raw electromyographic signal stream and the raw inertial signal stream to eliminate time delay differences, and perform signal quality screening processing to remove signal segments whose signal quality does not meet the preset requirements, so as to obtain synchronized electromyographic-inertial data stream.
[0023] The raw electromyographic signal stream refers to the continuous sampling sequence of the combined potential changes over time on the skin surface, generated by action potentials during muscle contraction when surface electromyographic electrodes are attached to the muscle being tested. This sequence directly reflects the superposition effect of action potentials of motor units and contains raw information such as muscle activation timing and contraction intensity. The raw inertial signal stream refers to the continuous sampling sequence of triaxial acceleration and triaxial angular velocity changes over time in the carrier coordinate system, synchronously acquired by inertial sensing elements such as accelerometers and gyroscopes. This sequence contains translational and rotational kinematic information of limb segments in space. Time axis alignment processing refers to addressing the issues of inconsistent sampling start times caused by the independent clock sources of the EMG and inertial acquisition devices, as well as the misalignment of sampling time points caused by clock drift. Time registration is performed using methods based on hardware synchronization pulse triggering or software post-processing interpolation. Specifically, firstly, the synchronization trigger markers of the two signals are extracted, or cross-correlation analysis is performed based on the signal waveform characteristics to estimate the delay. Then, using the sampling time axis of one signal as a reference, an interpolation algorithm is used to generate new sampling points for the other signal that strictly correspond to the reference time axis, so that each sampling point of the two signals ultimately represents the EMG and inertial measurement values at the same physical moment. Signal quality screening refers to the identification and removal of abnormal signal segments in the original signal caused by factors such as poor electrode contact, loose sensor fixation, excessive motion artifacts, or external electromagnetic interference. Specifically, firstly, the short-term amplitude range and baseline fluctuation level of the electromyographic signal are calculated. If the amplitude of multiple consecutive sampling points exceeds the physical upper limit of the sensor's linear working area or remains below the extremely low noise level for a long time, it is determined to be a signal saturation or missing segment. At the same time, the deviation of the acceleration magnitude of the inertial signal from the local gravitational acceleration and the transient change amplitude of the angular velocity signal are calculated. If the acceleration magnitude of consecutive sampling points deviates significantly from the gravitational acceleration for a long time and the angular velocity shows abnormal spikes, it is determined to be a segment of interference caused by severe impact or loosening of the sensor. These marked abnormal segments are removed from the data stream as a whole, and what remains is the synchronized electromyographic-inertial data stream after alignment and screening.
[0024] Step S200: Detect gait event trigger points in the synchronized electromyography-inertial data stream, identify heel strike event points and toe lift-off event points in the gait cycle, and segment the synchronized electromyography-inertial data stream according to the heel strike event points and toe lift-off event points to generate a set of gait cycle units based on the gait cycle.
[0025] Gait event trigger points refer to instantaneous movements with clear biomechanical significance during human walking. Specifically, these include the heel strike event point (the instant when the heel of one side first contacts the support surface) and the toe-off event point (the instant when the toe of the same side completely leaves the support surface). A gait cycle is defined as the time interval from the first heel strike on one side to the second heel strike on the same side. A gait cycle unit set refers to the sum of independent data segments formed by dividing a continuous data stream according to each gait cycle. In practice, firstly, energy analysis is performed on the electromyography signals in the synchronized data stream to extract temporal features related to muscle activation. Simultaneously, waveform analysis is performed on the inertial signals to extract kinematic features related to foot impact and swaying off the ground. Then, based on these two types of features, all possible candidate moments for heel strike and toe lift are initially screened. Next, based on the fundamental logic that heel strike and toe lift must alternate during human walking and that the time interval conforms to the physiological range, temporal consistency is verified on these candidate points. False detection points that do not conform to the alternation pattern or have abnormal time intervals are eliminated, resulting in a verified sequence of valid heel strike event points and a sequence of valid toe lift event points. Finally, using the time interval between two adjacent valid heel strike event points as the boundary, all data points corresponding to each gait cycle are precisely extracted from the synchronized data stream to form a set of gait cycle units.
[0026] In one embodiment, step S200 involves detecting gait event trigger points in the synchronized electromyography-inertial data stream, identifying heel strike event points and toe-off event points in the gait cycle, and segmenting the synchronized electromyography-inertial data stream based on the heel strike event points and toe-off event points to generate a set of gait cycle units based on gait cycles. Specifically, this may include the following steps S210 to S250: Step S210: Perform energy calculation on the electromyographic signals in the synchronized electromyographic-inertial data stream to obtain the electromyographic energy envelope curve, and detect local maxima in the electromyographic energy envelope curve as preliminary candidate points for heel strike.
[0027] Electromyography (EMG) energy calculation refers to transforming the raw EMG signal to highlight its intensity variations. Specifically, this involves calculating the root mean square value within a sliding window or obtaining the magnitude of the analytic signal through Hilbert transform, thereby converting the high-frequency oscillating raw EMG signal into an envelope curve reflecting the slow change in muscle activity intensity over time. Local maxima on the EMG energy envelope curve correspond to the peak moments of muscle contraction. During gait, the relevant muscles pre-activate before heel strike to prepare for impact, causing EMG activity to reach a local peak before and after landing. Therefore, these local maxima can serve as preliminary candidates for heel strike events. For example, the EMG signal is first rectified to obtain an absolute value sequence, and then smoothed using a low-pass filter. The filter can be, for example, a Butterworth filter or a moving average filter with a cutoff frequency of several hertz to tens of hertz. This filtering process eliminates the high-frequency pulsating components of the EMG signal, resulting in a smooth EMG energy envelope curve. Next, local peak detection is performed on the envelope curve. By setting a sliding window, the amplitude of the center point of the window is compared with that of other points in the window. If the amplitude of the center point is the maximum value in the window and is greater than the preset energy threshold, the point is marked as a local maximum point. All these points constitute preliminary candidate points for heel landing.
[0028] Step S220: Calculate the acceleration magnitude of the inertial signal in the synchronized electromyography-inertial data stream, and detect the zero-crossing point and trough point of the acceleration magnitude curve as preliminary toe-off candidate points and preliminary heel-off supplementary points.
[0029] The acceleration magnitude is a scalar value obtained by taking the square root of the sum of the squares of the three-axis acceleration components. It reflects the magnitude of the resultant acceleration experienced by the sensor and eliminates the influence of sensor attitude changes on the overall intensity measurement. A zero-crossing point refers to the position where the acceleration magnitude curve, after preprocessing, crosses from the positive half-axis to the negative half-axis or vice versa. A trough point refers to the location of a local minimum on the acceleration magnitude curve. In gait analysis, the acceleration change pattern occurs when the foot accelerates off the ground at the moment of toe liftoff, followed by a decrease in the acceleration magnitude during the subsequent swaying phase. Therefore, the trough points of the acceleration magnitude curve are highly correlated with the moment of toe liftoff. The impact of the heel striking the ground produces a sharp peak in the acceleration magnitude, but sometimes the zero-crossing points or troughs before and after the peak can also serve as auxiliary indicators. For example, first, the square root of the sum of the squares of the three-axis accelerations at each sampling moment is calculated to obtain the acceleration magnitude sequence. Then, to eliminate the influence of the gravity component, the gravity direction can be estimated by combining attitude calculations, and the gravity component can be subtracted from the original acceleration to obtain the motion acceleration. Finally, the magnitude of the motion acceleration is calculated. Next, the slope change of the motion acceleration magnitude sequence is calculated by first-order difference. The position where the slope changes from negative to positive is marked as the trough point as the initial toe-off candidate point. At the same time, the position where the slope changes from positive to negative is marked as the intersection of the falling edge and the rising edge of the peak as the initial heel-off supplementary point.
[0030] Step S230: Perform time sequence consistency checks on the initial heel strike candidate points, initial toe lift candidate points, and initial heel strike supplementary points, and remove abnormal candidate points that do not conform to the gait movement time sequence logic to obtain the effective heel strike event point sequence and the effective toe lift event point sequence.
[0031] Temporal sequence consistency verification refers to a comprehensive logical screening of all candidate points detected from multi-source signals, based on the physiological law that during normal human walking, heel strike and toe-off events must strictly alternate, and a complete gait cycle must contain exactly one heel strike and one toe-off. For example, firstly, preliminary heel strike candidate points from electromyography (EMG) signals and preliminary heel strike supplementary points from inertial signals are merged and deduplicated to form a unified set of heel strike candidate points. Then, this merged heel strike candidate point sequence is combined with the preliminary toe-off candidate point sequence and sorted in ascending order by timestamp, resulting in a mixed event list containing event type labels and timestamps. Next, an expected event type variable is set, and the list is traversed starting from the first event, checking whether the actual type of each event matches the expected type. The expected type cycles through heel strike, toe-off, and heel strike in that order. When the actual event type does not match the expected type, such as expecting heel-to-toe landing but encountering toe-to-toe landing, or encountering two consecutive events of the same type, these event points that do not conform to the alternation pattern are identified as abnormal candidate points. For consecutive events of the same type, further filtering is required based on the local amplitude of the event point or the time interval between the event and the preceding and following events, retaining event points with higher confidence and eliminating redundant points. After one or more rounds of iterative verification, the final sequence of event points that strictly conforms to the alternation pattern is the valid heel-to-toe landing event point sequence and the valid toe-toe landing event point sequence.
[0032] In one embodiment, step S230 involves performing a time sequence consistency check on the initial heel strike candidate points, initial toe-off candidate points, and initial heel strike supplementary points, eliminating abnormal candidate points that do not conform to the gait movement timing logic, and obtaining a valid heel strike event point sequence and a valid toe-off event point sequence. Specifically, this may include the following steps S231 to S235: Step S231: Merge and deduplicate the preliminary heel-landing candidate points and the preliminary heel-landing supplementary points to generate a set of heel-landing candidate points.
[0033] Merging and deduplication refers to integrating preliminary heel-landing candidate points detected based on electromyographic energy peak values and preliminary heel-landing supplementary points detected based on inertial acceleration waveforms into a single list, while eliminating redundant points that recur within a very small time window. For example, the two types of candidate points are first sorted by timestamp. Then, the sorted list is traversed, and the time difference between adjacent points is calculated. If the time difference is less than a preset minimum interval threshold, the two points are considered to correspond to the same heel-landing event. In this case, one point needs to be retained. The retention principle can be to select the point with the higher electromyographic energy peak amplitude, or the point that better matches the characteristics of the inertial impact waveform, or to take the time average of the two points as the new merged point, while removing the other point from the list. After merging and deduplication, a concise and non-redundant set of heel-landing candidate points is obtained.
[0034] Step S232: Based on the alternating occurrence of heel strike and toe lift events during gait, construct event time sequence constraints.
[0035] The event time sequence constraint stipulates that there must be at least one toe-off event between any two adjacent heel-landing event points, and that the toe-off event point must be located between the two heel-landing event points. This constraint is a formalized expression of the biomechanical logic of normal gait, specifically stating that in a valid gait event time sequence, there must be exactly one toe-off event between any two temporally adjacent heel-landing event points, and the time position of this toe-off event point must be strictly greater than the timestamp of the preceding heel-landing event point and strictly less than the timestamp of the following heel-landing event point. Correspondingly, there must also be exactly one heel-landing event between any two adjacent toe-off event points. This constraint eliminates any logical errors that might result in consecutive repetitions or missing event types, providing a criterion for subsequent traversal verification.
[0036] Step S233: Traverse the set of candidate points for heel landing and the initial candidate points for toe lifting off the ground in chronological order, and check whether each candidate point satisfies the event time order constraint.
[0037] The set of candidate heel-landing points and the initial set of candidate toe-off points are merged into a comprehensive list containing event type labels and timestamps, and then globally sorted in ascending order of timestamps. After sorting, the list is traversed sequentially from the first event point. During the traversal, a flag indicating the current expected event type is maintained, initially set to heel-landing. For each event point encountered, the actual type is compared with the current expected type. If they match, the event point has passed the current constraint check, and the expected type is switched to the next expected event type, such as switching from heel-landing to toe-off, or vice versa, before continuing to check the next event point. If they do not match, for example, the expected type is toe-off but a heel-landing event is actually encountered, a type mismatch is recorded, and the event point is marked as an exception candidate to be processed.
[0038] Step S234: Mark the candidate points that violate the event time sequence constraint as abnormal candidate points and remove them, and retain the candidate points that satisfy the event time sequence constraint as valid event points.
[0039] Based on the traversal check results in step S233, all event points marked as violating constraints are eliminated. For problems caused by type mismatch, such as the consecutive appearance of two event points of the same type, further analysis is needed to determine which of the two points is more likely to be a genuine gait event. Specifically, the characteristic intensity of the two points can be compared, such as the electromyographic energy amplitude or acceleration peak value corresponding to the heel strike candidate point. The point with the higher characteristic intensity is retained, and the point with the lower characteristic intensity is eliminated. Alternatively, the time interval between these two points and other event points of the preceding and following types can be considered, retaining the point whose time interval better matches the physiological gait range. After elimination, the remaining list of event points will satisfy a strict alternation pattern; these retained points are marked as valid event points.
[0040] Step S235: Perform neighborhood redundancy removal on the valid event points to ensure that only one heel strike event point and one toe lift event point are retained in each gait cycle, thus obtaining the valid heel strike event point sequence and the valid toe lift event point sequence.
[0041] Neighborhood redundancy removal further eliminates the potential for duplicate detections within localized areas, building upon the already established alternation pattern of valid event points. Even though event types have alternated, due to gait variability or the sensitivity of detection algorithms, two extremely close valid heel points may still exist near the same actual heel strike time, which physically cannot correspond to two actual landings. For example, a minimum event interval threshold is first set, which can be a certain proportion of the average cycle length based on gait cycle statistical characteristics. Then, the valid heel strike event point sequence and the valid toe-off event point sequence are traversed separately, calculating the time interval between two adjacent similar event points. If this interval is less than the set minimum interval threshold, redundancy is considered to exist between these two points. The point that is more consistent with the historical event point distribution or has more significant characteristics is retained, while the other point is discarded. After neighborhood redundancy removal, the resulting valid heel strike event point sequence and valid toe-off event point sequence maintain a reasonable physiological interval between adjacent similar event points, ensuring that each actual gait cycle corresponds to a unique heel strike event and a unique toe-off event.
[0042] Step S240: Construct a gait cycle segmentation window based on the effective heel strike event point sequence and the effective toe-off event point sequence. Use the time interval between two adjacent heel strike event points as a gait cycle window, and identify the heel strike event point and toe-off event point as intermediate key event points within each gait cycle window.
[0043] A gait cycle segmentation window refers to the start and end time range used to divide a continuous data stream into individual gait cycles. Based on the obtained sequence of valid heel strike events, the time interval between any two consecutive valid heel strike events is naturally defined as a gait cycle window. Specifically, if the timestamps of the valid heel strike events are T1, T2, T3, etc., then the interval [T1, T2] is the first gait cycle window, the interval [T2, T3] is the second gait cycle window, and so on. Within each constructed gait cycle window, there must be a valid toe-off event. It is necessary to find the point whose timestamp falls within the window interval from the sequence of valid toe-off events and associate it with the window. This heel strike event, which serves as the starting point of the window, and the toe-off events within the window together constitute the intermediate key event points within the gait cycle, providing precise time anchors for subsequent gait phase segmentation.
[0044] Step S250: Slice the synchronized electromyography-inertial data stream according to the gait cycle window, generate the electromyography signal subsequence and inertial signal subsequence corresponding to each gait cycle window, and mark the start point, end point and internal key event points of each gait cycle window to obtain a set of gait cycle units.
[0045] Data slicing refers to the precise extraction of all sampling points within a corresponding time period from the original synchronized electromyography-inertial data stream based on the start and end time indices of the gait cycle window. For a gait cycle window [T1, T2], all electromyography signal sampling points with timestamps greater than or equal to T1 and less than or equal to T2 are extracted from the data stream to form an electromyography signal subsequence. Simultaneously, all inertial signal sampling points within the same timestamp range are extracted to form an inertial signal subsequence. After data extraction, structured labeling information is added to each cycle unit. The labeling content includes the start timetamp of the cycle window, i.e., T1, the end timetamp, i.e., T2, and the time offset of the internal key event points, i.e., the heel strike event point T1 and the toe lift event point, relative to T1. After this processing, the continuous synchronized data stream is divided into a series of independent gait cycle units with clear boundaries and internal labels. The set of all these units is the gait cycle unit set.
[0046] In one embodiment, step S250 involves slicing the synchronized electromyography-inertial data stream according to gait cycle windows to generate electromyography signal subsequences and inertial signal subsequences corresponding to each gait cycle window, and marking the start point, end point, and internal key event points of each gait cycle window to obtain a set of gait cycle units. Specifically, this may include the following steps S251 to S255: Step S251: Extract the start point time index and end point time index of each gait cycle window, and extract the corresponding original electromyographic data segment and original inertial data segment from the synchronized electromyographic-inertial data stream according to the start point time index and end point time index to obtain the initial gait cycle slice data package.
[0047] The start and end time indices refer to the specific sampling point numbers corresponding to the gait cycle window in the raw data stream. These two indices allow direct location of the specific position in the data storage. For example, firstly, the timestamps of valid heel strike events are converted into sampling point numbers in the data stream, resulting in the start and end indices. Then, all rows of data from the start to the end index are copied from the data array storing the synchronized EMG-Inertial data stream. Each row contains the EMG voltage value at that sampling moment, as well as the triaxial acceleration and triaxial angular velocity values from the inertial sensor. These copied raw data segments collectively constitute the initial gait cycle slice data packet for that gait cycle window.
[0048] Step S252: Bandpass filtering is performed on the original electromyographic data segments in the initial gait cycle slice data package to retain the effective frequency band components of the electromyographic signal, and adaptive noise cancellation is performed to remove motion artifact interference, generating a purified electromyographic signal subsequence.
[0049] Bandpass filtering is designed to address the spectral distribution characteristics of electromyography (EMG) signals. The effective energy of an EMG signal is primarily concentrated within a specific frequency range. Components below the lower limit of this range typically contain motion artifacts and baseline drift, while components above the upper limit are mostly high-frequency noise. For example, a bandpass filter is configured to cover the frequency band where the main energy of the EMG signal is concentrated, such as a lower limit of tens to tens of hertz and an upper limit of hundreds to five hundred hertz. The raw EMG data segment is input into this bandpass filter, which uses its transfer function to select frequencies, allowing frequency components within the passband to pass while attenuating frequency components outside the passband, thus obtaining an EMG signal with out-of-band noise removed. Adaptive noise cancellation is used to further eliminate motion-related interference, whose frequencies may overlap with the EMG signal and cannot be removed by a fixed bandpass filter. For example, the acceleration signal in the synchronously acquired inertial signal is used as a reference noise source and input into an adaptive filter. The filter uses the least mean square algorithm or the recursive least square algorithm to dynamically adjust the filter coefficients according to the correlation between the reference noise and the noise in the electromyography signal. The estimated noise component is subtracted from the bandpass filtered electromyography signal to obtain a further purified electromyography signal subsequence.
[0050] Step S253: Perform zero-bias stability estimation on the original inertial data segment in the initial gait cycle slice data packet, perform offset compensation on the original inertial data segment based on the estimated zero-bias value, and perform coordinate system alignment on the compensated inertial data to transform the data in the sensor coordinate system to the global reference coordinate system, thereby generating a calibrated inertial signal subsequence.
[0051] Zero-bias stability estimation refers to determining the output offset of an inertial sensor under zero-input conditions. For example, the sensor can be kept stationary for a period before or after data acquisition begins, inertial data can be collected during this stationary period, and then the arithmetic mean of the accelerometer and gyroscope output values for each axis can be calculated. This average value is the zero-bias estimate for that axis. Offset compensation involves subtracting the corresponding zero-bias value from the value of each sampling point in the original inertial data segment to eliminate systematic measurement biases of the sensor. Coordinate system alignment refers to transforming the data measured in the sensor's own coordinate axes to a fixed global reference coordinate system. For example, firstly, attitude fusion is performed using complementary filtering or Kalman filtering algorithms on the gyroscope and accelerometer data to calculate the rotation relationship between the sensor coordinate system and the global coordinate system, usually represented by quaternions. Then, this rotation quaternion is used to perform a rotation transformation on the compensated acceleration and angular velocity data, that is, the vectors in the sensor coordinate system are rotated to the global coordinate system through quaternion multiplication, thus obtaining the acceleration and angular velocity data in the global reference coordinate system, which is the calibrated inertial signal subsequence.
[0052] Step S254: Realign the purified electromyographic signal subsequence and the calibrated inertial signal subsequence on the time axis, check the time synchronization deviation between the two, and if there is a time deviation, make the sampling time points of the two completely correspond through interpolation and resampling to generate time-synchronized electromyographic-inertial paired data units.
[0053] Although the original data stream has been aligned in step S100, a series of processes, including bandpass filtering, adaptive filtering, zero-bias compensation, and coordinate transformation, may introduce time deviations between the EMG and inertial signal subsequences, especially if these processes involve filter delays of different lengths or data resampling. Realignment is necessary to ensure that the two signals remain precisely time-corresponding in the final analysis stage. For example, firstly, the sampling timestamp sequences of the purified EMG signal subsequence and the calibrated inertial signal subsequence are extracted, and the start and end time differences between the two sets of sequences are calculated. If the absolute values of both the start and end time differences are less than a preset minimum time threshold, such as less than half a sampling interval, they are considered synchronized and can be directly paired. If the deviation exceeds the threshold, resynchronization is required. In this case, the signal subsequence with the higher sampling rate is designated as the reference sequence, and the signal subsequence with the lower sampling rate is designated as the sequence to be adjusted. Then, spline interpolation is performed on the sequence to be adjusted. Using the sampling timestamp of the reference sequence as the independent variable, an interpolation function is constructed using the original data points of the sequence to be adjusted to generate an interpolated signal value that completely corresponds to the sampling timestamp of the reference sequence, ensuring that the number of sampling points in the sequence to be adjusted is consistent with that in the reference sequence. Next, anti-aliasing filtering is applied to the interpolated sequence to eliminate high-frequency noise that may be introduced during the interpolation process. Finally, the reference sequence and the adjusted signal subsequence are paired and encapsulated according to the one-to-one correspondence of sampling points to generate time-synchronized electromyographic-inertial paired data units.
[0054] In one embodiment, step S254 involves realigning the purified electromyographic signal subsequence and the calibrated inertial signal subsequence on the time axis, checking for time synchronization deviation between them, and if a time deviation exists, interpolating and resampling to ensure that the sampling time points of the two are completely corresponding, thereby generating a time-synchronized electromyographic-inertial paired data unit. Specifically, this may include the following steps S2541 to S2545: Step S2541: Extract the sampling timestamp sequence of the purified electromyographic signal subsequence and the sampling timestamp sequence of the calibrated inertial signal subsequence, calculate the start time difference and the end time difference between the two sets of sampling timestamp sequences, and determine that the two are synchronized if both the start time difference and the end time difference are less than the preset time threshold.
[0055] The sampling timestamp sequence refers to a list of time values recording the acquisition time of each data point. The start time difference is the absolute value of the difference between the first timestamp of the EMG signal subsequence and the first timestamp of the inertial signal subsequence. The end time difference is the absolute value of the difference between the last timestamp of the EMG signal subsequence and the last timestamp of the inertial signal subsequence. A preset time threshold is set to a very small value, typically half the sampling interval. If both differences are less than this threshold, it indicates that the two subsequences are highly consistent in their start and end times, and they can be considered to have achieved time synchronization, requiring no further processing before direct pairing.
[0056] Step S2542: If the purified electromyographic signal subsequence is not synchronized with the calibrated inertial signal subsequence, then the signal subsequence with the higher sampling rate is determined as the reference sequence, and the signal subsequence with the lower sampling rate is determined as the sequence to be adjusted.
[0057] If the start time difference or end time difference exceeds a preset threshold, it indicates that there is a synchronization deviation between the two sequences that needs to be corrected. In this case, the sampling rates of the two signal sub-sequences need to be compared. The sequence with the higher sampling rate, due to its higher time resolution, can provide a more accurate time reference and is therefore selected as the reference sequence. The sequence with the lower sampling rate is then used as the sequence to be adjusted, and its sampling points need to be adjusted to the same time points as the reference sequence.
[0058] Step S2543: Perform spline interpolation on the sequence to be adjusted to generate an interpolated signal value that completely corresponds to the sampling timestamp of the reference sequence, so that the number of sampling points in the sequence to be adjusted is consistent with the number of sampling points in the reference sequence.
[0059] Spline interpolation is a method that uses a piecewise polynomial function to fit discrete points, thereby estimating values at any position between known points. In practice, a cubic spline interpolation function is constructed using the original timestamps of the sequence to be adjusted as independent variables and the original signal values as dependent variables. This function fits a cubic polynomial between each adjacent original data point, ensuring continuity of the function value, first derivative, and second derivative at the connection points. Then, each sampling timestamp of the reference sequence is input into this interpolation function as an independent variable, and the function output is the estimated signal value at the reference timestamp. In this way, a new sequence is generated that perfectly matches the sampling timestamps of the reference sequence.
[0060] Step S2544: Perform anti-aliasing filtering on the interpolated sequence to be adjusted to eliminate high-frequency noise components introduced by interpolation, and obtain an adjusted signal subsequence aligned with the time axis of the reference sequence.
[0061] While interpolation can generate smooth curves, it may also introduce high-frequency components not present in the original signal, affecting the spectral purity. Anti-aliasing filtering typically employs a low-pass filter with a cutoff frequency set below the original Nyquist frequency of the sequence to be adjusted, i.e., half the original sampling rate. Passing the interpolated sequence through this low-pass filter smooths out the unnatural high-frequency jitter introduced during interpolation, making the interpolated signal closer to the true frequency band of the original signal in the frequency domain. The resulting filtered sequence is the adjusted signal subsequence perfectly aligned with the time axis of the reference sequence.
[0062] Step S2545: Pair and encapsulate the reference sequence with the adjusted signal subsequence to generate time-synchronized electromyographic-inertial paired data units where each sampling point on the time axis simultaneously contains electromyographic signal values and inertial signal values.
[0063] Paired encapsulation refers to combining two sequences with completely identical time axes into a unified data structure according to a one-to-one correspondence between sampling points. The final generated data structure is a two-dimensional tabular data matrix, with the number of rows equal to the number of sampling points in the reference sequence. Each row represents a sampling time point and contains multiple fields: the electromyographic signal value, the triaxial acceleration value, and the triaxial angular velocity value at that time point. This data organization, where pairs appear at every time point, is a time-synchronized electromyographic-inertial paired data unit.
[0064] Step S255: Add structured description information to the electromyography-inertial pairing data unit. The structured description information includes the start time stamp of the gait cycle window, the end time stamp of the gait cycle window, the relative time offset of the heel strike event point within the gait cycle window, and the relative time offset of the toe lift-off event point within the gait cycle window. The electromyography-inertial pairing data unit with added structured description information is used as a complete gait cycle unit, and all gait cycle units corresponding to all gait cycle windows are collected into a gait cycle unit set.
[0065] Structured descriptive information supplements the metadata of the data unit's attributes, giving it clear semantics and contextual relevance. The start and end timestamps are directly linked back to the original global timeline, indicating the absolute position of the data unit throughout the acquisition process. The relative time offset is the positional marker of key events within the gait cycle, typically expressed as the time difference relative to the cycle's start point. For example, for each EMG-INS paired data unit, the start and end timestamps of its corresponding gait cycle window are obtained, along with the timestamps of the heel strike and toe-off events within that window. The difference between the toe-off event timetamp and the start timestamp is then calculated as the toe-off relative time offset. Since the heel strike timetamp coincides with the start timestamp, the offset is zero. After adding this information as a header or additional fields to the corresponding EMG-INS paired data unit, the data unit is transformed into a complete gait cycle unit containing full contextual information. Gymnastics cycle units corresponding to all gait cycle windows are grouped together chronologically to form a gait cycle unit set.
[0066] Step S300: Extract the envelope features of the electromyographic signal segments contained in each gait cycle unit in the gait cycle unit set, and extract the posture angle change sequence of the contained inertial signal segments. Perform correlation analysis between the envelope features of the electromyographic signal segments and the posture angle change sequence of the inertial signal segments to obtain the electromyographic-inertial coupling activation mode descriptor that reflects the synergistic relationship between electromyographic activity and inertial motion.
[0067] Envelope feature extraction refers to extracting a smooth contour of the intensity change over time from an electromyographic (EMG) signal segment. This contour reflects the dynamic change of muscle contraction force throughout the gait cycle. Posture angle change sequence extraction refers to obtaining a sequence describing the spatial orientation of limb segments over time from inertial signal segments through data fusion and decomposition. This sequence visually demonstrates the swinging and rotational trajectories of the limb during the gait cycle. Correlation analysis involves jointly examining the EMG envelope features and posture angle change sequences within the same time period to explore the intrinsic relationship between muscle activation and specific movement postures. The EMG-inertial coupling activation pattern descriptor is a quantitative representation of this correlation, containing high-level features such as the joint angle corresponding to the peak muscle activation and the synchronization relationship between muscle activity and angular velocity changes. For example, firstly, the EMG signals in the gait cycle unit are subjected to full-wave rectification and low-pass filtering to obtain a smooth EMG envelope curve. Then, the curve is normalized to eliminate individual differences, generating an EMG envelope feature sequence. Simultaneously, attitude calculation is performed on the inertial signals in the gait cycle unit. Complementary filtering is used to fuse accelerometer and gyroscope data to calculate the real-time pitch or roll angle changes of the limb in the sagittal plane. The angle sequences are then differentiated to obtain the angular velocity change trend, which serves as the attitude angle change sequence. The electromyography (EMG) envelope feature sequence and the attitude angle change sequence are then input into a sliding analysis window. Local segments are extracted at each window position, and the complexity indices of the EMG local segments (e.g., fractal dimension) and the regularity indices of the inertial local segments (e.g., sample entropy) are calculated. The correlation between these two indices (e.g., Pearson correlation coefficient) is then calculated to obtain the local coupling strength value. The local coupling strength values at all sliding positions are arranged chronologically to form a coupling strength evolution curve. Peak detection is performed on this curve, and the amplitude of each peak and its corresponding time position are extracted. Finally, the amplitude sequence and time position sequence of these peak points are combined into a multi-dimensional feature vector, which is the EMG-inertial coupling activation mode descriptor.
[0068] In one embodiment, step S300 involves extracting envelope features from the electromyographic signal segments contained in each gait cycle unit in the gait cycle unit set, extracting the posture angle change sequence from the contained inertial signal segments, and performing correlation analysis between the envelope features of the electromyographic signal segments and the posture angle change sequence of the inertial signal segments to obtain an electromyographic-inertial coupling activation mode descriptor reflecting the synergistic relationship between electromyographic activity and inertial motion. Specifically, this may include the following steps S310 to S350: Step S310: Perform full-wave rectification on the electromyographic signal segment in the gait cycle unit, smooth the rectified electromyographic signal through a low-pass filter, extract the linear envelope curve reflecting the overall intensity of electromyographic activity, and normalize the amplitude of the linear envelope curve to obtain the electromyographic envelope feature sequence.
[0069] Full-wave rectification converts all negative voltage values in an electromyography (EMG) signal into corresponding positive voltage values. Specifically, it involves taking the absolute value of the amplitude at each sampling point. This results in a signal where all values are positive, preserving the complete energy information of the signal. Low-pass filter smoothing uses a low-pass filter with a cutoff frequency set to retain the main frequency components of the EMG signal envelope variation while filtering out high-frequency pulsations. The rectified EMG signal is input into this low-pass filter, which, through its frequency response characteristics, allows low-frequency components to pass while attenuating high-frequency components, outputting a smooth linear envelope curve. Amplitude normalization eliminates absolute amplitude differences between different measurements, making the extracted features comparable. For example, the maximum value of the linear envelope curve over the entire gait cycle is found, and then the value at each point on the curve is divided by this maximum value to obtain a relative intensity sequence with all values between zero and one. Alternatively, it can be divided by the average value of the envelope curve over the entire cycle to obtain a sequence of changes relative to the average intensity. The normalized linear envelope curve is the EMG envelope feature sequence.
[0070] Step S320: Perform complementary filtering and fusion on the three-axis acceleration data and three-axis angular velocity data in the inertial signal segment of the gait periodic unit to obtain the quaternion of the carrier coordinate system relative to the navigation coordinate system. Convert the quaternion into the roll angle sequence, pitch angle sequence and yaw angle sequence in Euler angle form. Perform differential operation on the roll angle sequence, pitch angle sequence and yaw angle sequence to obtain the angular velocity change trend sequence as the attitude angle change sequence.
[0071] Complementary filtering fusion is an attitude estimation algorithm that combines the advantages of accelerometers and gyroscopes. Accelerometers can accurately measure the direction of gravity in the low-frequency band but are susceptible to interference from motion acceleration; gyroscopes can accurately measure angular velocity in the high-frequency band, but integration introduces drift. Complementary filtering, through a frequency compensation function, allows the gyroscope to dominate the dynamic changes in the signal, while the attitude estimated by the accelerometer corrects for the long-term drift of the gyroscope. For example, a quaternion is first initialized to represent the current attitude. Then, the quaternion is updated using the angular velocity measured by the gyroscope to obtain the predicted attitude. Simultaneously, the observed attitude is calculated using the direction of gravity measured by the accelerometer. Then, the predicted and observed attitudes are fused according to a weighting factor. The weighting factor is designed to place more trust in the gyroscope's prediction during dynamic changes and more trust in the accelerometer's observation during static or uniform motion, thus obtaining a corrected quaternion. This process is repeated, outputting a quaternion at each sampling time. After obtaining the quaternion sequence, the conversion relationship between quaternions and Euler angles is used, that is, the corresponding roll angle, pitch angle, and yaw angle are calculated based on the four components of the quaternion using arctangent and arcsine functions. After obtaining the angle sequence, a first-order difference operation is performed on each angle sequence, that is, the angle value at the next moment is subtracted from the angle value at the previous moment and then divided by the sampling time interval to obtain the rate of change of angle with time, which is the angular velocity change trend sequence. This sequence is selected as the attitude angle change sequence.
[0072] Step S330: Input the electromyography envelope feature sequence and the posture angle change sequence into the pre-constructed coupling analysis window. The coupling analysis window slides on the time axis at a fixed time length, and at each sliding position, a local segment of the electromyography envelope feature sequence and a local segment of the posture angle change sequence are extracted.
[0073] The coupling analysis window is a tool used to study the relationship between two time series within a local time interval. This analysis window has a fixed time length, set to cover the main motion events in the gait cycle but shorter than the entire cycle length, allowing the analysis to focus on local dynamic changes. The window starts from the common starting point of the two sequences and moves forward step by step with a fixed sliding step size. The sliding step size is shorter than the time length to ensure overlapping areas between adjacent windows, thus achieving continuous and smooth analysis. Each time the window moves to a new position, it covers a time interval from the current starting time to the current starting time plus the time length. Within this interval, all data points with timestamps falling within this interval are extracted from the electromyography envelope feature sequence, forming a local segment of the electromyography envelope feature sequence; simultaneously, all data points within the same time interval are extracted from the posture angle change sequence, forming a local segment of the posture angle change sequence. Through this sliding window approach, a complete gait cycle signal is decomposed into a series of overlapping local segment pairs.
[0074] In one embodiment, step S330 involves inputting the electromyography envelope feature sequence and the posture angle change sequence into a pre-constructed coupling analysis window. The coupling analysis window slides along the time axis at a fixed time length, and at each sliding position, local segments of the electromyography envelope feature sequence and local segments of the posture angle change sequence are extracted. Specifically, this may include the following steps S331 to S335: Step S331: Preset the time length parameter and sliding step size parameter of the coupling analysis window. The time length parameter is greater than half of the average duration of a gait cycle unit and less than the average duration of a gait cycle unit. The sliding step size parameter is less than the time length parameter to ensure that there is an overlapping area between adjacent windows.
[0075] The setting of the time length parameter needs to balance the locality and representativeness of the analysis. If the window is too short, it may fail to capture the complete causal relationship between the electromyographic burst and the motor response; if the window is too long, local details will be lost, resulting in a global average. Therefore, setting it to be greater than half a cycle and less than one cycle is a reasonable choice. The sliding step size parameter determines the temporal resolution; a smaller step size results in a denser analysis of time points, but also increases the computational cost. To ensure the continuity and smoothness of the analysis, the sliding step size must be smaller than the time length, allowing for overlap between adjacent windows.
[0076] Step S332: Starting from the common starting point of the electromyography envelope feature sequence and the posture angle change sequence, gradually move the starting position of the coupling analysis window according to the sliding step size parameter.
[0077] The starting point of the analysis window is initially set at the time position corresponding to the first sampling point of the two sequences. Then, according to a preset sliding step size, the starting point is continuously moved backward, and the time range covered by the window is shifted backward by the same amount of time with each movement. This process continues until the starting position of the window is moved to a position where the ending position of the window touches or exceeds the last sampling point of the two sequences.
[0078] Step S333: At each current sliding position, determine the termination position of the coupling analysis window based on the time length parameter, and extract all electromyographic envelope feature values from the electromyographic envelope feature sequence within the range from the current sliding position to the termination position to form a local segment of the electromyographic envelope feature sequence.
[0079] For the current sliding start time point, the window's end time point is the start time point plus a preset time length parameter. Then, in the electromyographic envelope feature sequence, all data points with timestamps greater than or equal to the start time point and less than or equal to the end time point are found by timestamp index. These points are extracted in chronological order, thus forming a local segment of the electromyographic envelope feature sequence at that sliding position.
[0080] Step S334: Simultaneously extract all posture angle change values within the time range that completely correspond to the local segments of the electromyographic envelope feature sequence from the posture angle change sequence to form a local segment of the posture angle change sequence.
[0081] Using the exact same timeframe as the extracted local segments of the electromyographic envelope—that is, from the same start time to the same end time—all corresponding data points were extracted from the attitude angle change sequence using timestamp indexing. This ensured that the resulting pair of local segments were strictly synchronized and reflected data from two different signal observations within the same time period.
[0082] Step S335: Pair the local segments of the electromyographic envelope feature sequence and the local segments of the posture angle change sequence to generate a local coupling analysis data pair corresponding to the current sliding position, which can be used for subsequent calculation of the local coupling strength value.
[0083] The local segment of electromyographic envelope extracted in step S333 and the local segment of posture angle change extracted in step S334 are combined to form a data pair. This data pair contains information on how the intensity of electromyographic activity and the limb posture angle change within the current analysis window, and serves as the direct input for subsequent calculation of the local coupling strength at that moment.
[0084] Step S340: At each sliding position, the fractal dimension of the local segment of the electromyographic envelope feature sequence is calculated to obtain the electromyographic complexity index. The sample entropy of the local segment of the attitude angle change sequence is calculated to obtain the inertial motion regularity index. The Pearson correlation coefficient between the electromyographic complexity index and the inertial motion regularity index is calculated to obtain the local coupling strength value.
[0085] Fractal dimension is an indicator that measures the complexity of the geometric structure and nonlinearity of a time series. For local segments of the electromyography (EMG) envelope, its fractal dimension can be calculated using the box counting method, which involves covering the signal curve with boxes of different scales, statistically analyzing the relationship between the number of boxes required for coverage and the scale, and obtaining the dimension by fitting a double logarithmic curve; alternatively, the Hurst exponent method can be used, estimating it by analyzing the relationship between the rescaled range of the signal and the observation time. A higher fractal dimension usually indicates a more complex and variable fluctuation pattern in the EMG signal. Sample entropy is an indicator that measures the regularity of a time series and is used to assess the probability of generating new patterns in the signal. For local segments of attitude angle changes, when calculating their sample entropy, the embedding dimension and similarity tolerance are first set, then the phase space is reconstructed, and the number of vectors whose distance from each other is less than the similarity tolerance is counted. The entropy value is obtained by calculating the logarithmic form of the conditional probability. Lower sample entropy indicates more regular and repetitive motion patterns, while higher sample entropy indicates more complex and variable motion patterns. The Pearson correlation coefficient is a statistic that measures the degree of linear correlation between two variables. At each sliding position, the calculated electromyographic complexity index and the inertial motion regularity index are used as two variables. The Pearson correlation coefficient between these two values is calculated across all sliding windows. This is achieved by first calculating the mean of each index, then summing the products of the deviations of each index from its respective mean for each window, and finally dividing by the product of the standard deviations of the two indices and the number of windows. This correlation coefficient reflects whether there is a covariance between the complexity of electromyographic activity and the regularity of motion within that local time period; it represents the local coupling strength value at that sliding position.
[0086] Step S350: Arrange the local coupling strength values in chronological order to form a coupling strength evolution curve. Perform peak detection on the coupling strength evolution curve, extract the amplitude of the peak point and its corresponding time position, and combine the amplitude sequence and time position sequence of the peak point into an electromyography-inertial coupling activation mode descriptor.
[0087] The coupling strength evolution curve is plotted with time on the x-axis and the local coupling strength value calculated for each sliding window on the y-axis, illustrating the dynamic change in the strength of the coupling relationship between electromyographic activity and inertial motion within a gait cycle. Peak detection identifies local maxima on this evolution curve; these peaks correspond to the moments when the electromyographic-inertial coupling strength reaches a local maximum, typically also corresponding to key control transition points in the gait cycle. For example, firstly, the first derivative of the coupling strength evolution curve is calculated to obtain a slope change sequence, and zero-crossing points where the slope changes from positive to negative are identified as candidate peak points. Then, each candidate peak point is verified to determine if it is the maximum value within its neighborhood, i.e., by comparing the coupling strength values of that point with its left and right neighboring points. If the value of that point is greater than the values of its neighboring points, it is confirmed as a valid peak point. The y-axis value of each valid peak point is extracted as the peak point amplitude, and the x-axis value of each valid peak point is extracted as the peak point temporal position. Arrange the peak amplitudes of all valid peak points in chronological order to form a peak amplitude sequence, and arrange the peak time positions of all valid peak points in chronological order to form a peak time sequence. Then, encode these two sequences together, for example, by combining them into a two-dimensional array, to generate an electromyography-inertial coupling activation mode descriptor.
[0088] In one embodiment, step S350 involves arranging the local coupling strength values in chronological order to form a coupling strength evolution curve, performing peak detection on the coupling strength evolution curve, extracting the amplitude of the peak points and their corresponding time positions, and combining the amplitude sequence and time position sequence of the peak points into an electromyography-inertial coupling activation mode descriptor. Specifically, this may include the following steps S351 to S355: Step S351: Sort the local coupling strength values calculated for each sliding position according to the corresponding sliding window center time point to generate a coupling strength evolution curve with time as the horizontal axis and coupling strength value as the vertical axis.
[0089] Each sliding window has a center time point, which can be the average of the window's start and end time points. The local coupling strength value calculated for each window is correlated with its center time point, and then all data points are connected in ascending order of their center time points to form a continuous curve, which is the coupling strength evolution curve.
[0090] Step S352: Calculate the first derivative of the coupling strength evolution curve to obtain the curve slope change sequence, and detect the zero-crossing point of the curve slope change sequence from positive to negative as the candidate peak point position.
[0091] Calculating the first derivative of the evolution curve, i.e., calculating the instantaneous rate of change of the curve at each point, reveals that at local peak points, the slope must change from a positive increasing phase to a negative decreasing phase. Therefore, we can identify the time points in the derivative sequence where the positive value crosses zero and then becomes negative; these points correspond to the candidate peak point locations.
[0092] Step S353: For each candidate peak point location, compare its coupling strength value with the coupling strength values of the two adjacent left and right sampling points. If the coupling strength value of the candidate peak point location is greater than the coupling strength values of the two adjacent left and right sampling points, it is confirmed as a valid peak point.
[0093] Relying solely on the zero-crossing of the first derivative might detect spurious peaks caused by minor fluctuations. To eliminate these spurious peaks, local maxima verification is needed for each candidate peak point. This involves comparing the coupling strength between the point and its immediate left and right neighbors, or comparing it with all points in a small neighborhood formed by multiple points to its left and right. Only when the value of the current point is strictly greater than the values of its left and right neighbors is it finally confirmed as a true local maximum point, i.e., a valid peak point.
[0094] Step S354: Extract the coupling strength value of each effective peak point as the peak point amplitude, and extract the time point corresponding to each effective peak point as the peak point time position.
[0095] For each valid peak point verified in step S353, record two key pieces of information. First, the vertical coordinate value of the point on the coupling strength evolution curve, i.e., the local coupling strength value, denoted as the peak point amplitude. Second, the horizontal coordinate value of the point on the time axis, i.e., its central time point, denoted as the peak point time position.
[0096] Step S355: Arrange the peak amplitudes of all valid peak points into a peak amplitude sequence according to time order, arrange the peak time positions of all valid peak points into a peak time sequence according to time order, and associate the peak amplitude sequence with the peak time sequence to generate an electromyography-inertial coupling activation mode descriptor.
[0097] Suppose several valid peak points are detected within a gait cycle unit, and they are numbered chronologically. The peak amplitude sequence is the list of amplitudes arranged in this order, and the peak time sequence is the list of time positions arranged in this order. Association encoding refers to organically combining these two sequences to form a complete descriptor. Specifically, this can be done by combining the two sequences into a two-column matrix, with the first column representing the time position and the second column representing the amplitude, or by concatenating the two sequences as two parts of a feature vector. This matrix or vector data is the final electromyographic-inertial coupling activation pattern descriptor, which characterizes the key moments and strengths of the strong coupling between electromyography and motion within that gait cycle.
[0098] Step S400: Call the pre-built gait phase state transition model to perform phase transition path reasoning on the electromyography-inertial coupling activation mode descriptor. The gait phase state transition model is configured with a time recursive structure. Based on the time evolution trend of the electromyography-inertial coupling activation mode descriptor, it generates the phase state nodes that appear successively in the gait cycle and the transition direction between the phase state nodes, thus obtaining the phase state transition path topology.
[0099] The gait phase state transition model is a pre-trained deep learning model whose core function is to receive a feature sequence within a gait cycle and output the evolution of gait phase states within that cycle. The temporal recursive structure is a network architecture within the model specifically designed to process sequential data, capturing the dependencies between data points. It is typically implemented using gated recurrent units or long short-term memory units. Phase state nodes refer to the various stages in the gait cycle that have clear biomechanical significance, such as the support phase, swing phase, or more precisely, the weight-bearing reaction phase, mid-support phase, late support phase, and early swing phase. The transition direction refers to the sequence of changes from one phase state node to another. The phase state transition path topology is a directed graph structure containing all occurring phase state nodes and their transition directions. For example, the electromyography-inertial coupling activation pattern descriptor is first fed into the model as the input feature sequence. The bidirectional temporal recursive structure layer within the model extracts the temporal dependency features of the sequence from both forward and backward directions, generating a contextual feature vector sequence that integrates contextual information. Next, the attention pooling layer calculates the contribution weight of each time step to phase state discrimination, and performs a weighted summation of the context feature vectors to generate a global temporal feature representation focused on key time steps. Then, the state decoder maps the global feature representation into a discrete sequence of phase state nodes through multiple layers of nonlinear mapping. Finally, the sequence of phase state nodes is merged with consecutive identical states, and the start time, end time, and phase state label of each phase state residence segment are extracted. Based on this information, a phase state transition path topology consisting of phase state nodes and directed transition edges is constructed.
[0100] In one embodiment, step S400 involves calling a pre-built gait phase state transition model to perform phase transition path inference on the electromyography-inertial coupling activation mode descriptor. The gait phase state transition model is configured with a time recursive structure. Based on the time evolution trend of the electromyography-inertial coupling activation mode descriptor, it generates the phase state nodes that appear successively within the gait cycle and the transition directions between the phase state nodes, thereby obtaining the phase state transition path topology. Specifically, this may include the following steps S410 to S450: Step S410: Perform feature fusion on the peak amplitude sequence and peak time sequence in the electromyography-inertial coupling activation mode descriptor to generate a joint feature vector containing amplitude and time information, and arrange the joint feature vector in time order to form the input feature sequence.
[0101] Feature fusion refers to merging information describing the same peak point but with different dimensions into a unified vector representation. The peak amplitude sequence and peak time sequence are inherently time-aligned, with each peak point corresponding to a time position and an amplitude. For each valid peak point, its time position and amplitude are combined to form a two-dimensional feature vector. These two-dimensional vectors are then arranged according to their original time order to form an input feature sequence. The length of this sequence is equal to the number of valid peak points, and this sequence serves as the direct input to subsequent time-recursive structures.
[0102] Step S420: Feed the input feature sequence into the bidirectional temporal recursive structure layer in the gait phase state transition model in sequence. Extract the forward dependency features of the sequence from front to back through the forward recursive unit of the bidirectional temporal recursive structure layer, and extract the backward dependency features of the sequence from back to front through the backward recursive unit of the bidirectional temporal recursive structure layer. Concatenate the forward dependency features and the backward dependency features to generate a context feature vector sequence that integrates forward and backward temporal information.
[0103] The bidirectional temporal recursive structure layer consists of recursive units in two directions. The forward recursive units process the input sequence in forward chronological order, with each time step's output implicitly containing all information from the beginning of the sequence to the current time step. The backward recursive units process the input sequence in reverse chronological order, with each time step's output implicitly containing all information from the end of the sequence to the current time step. The forward and backward outputs of the same time step are concatenated to obtain the context feature vector for that time step. This concatenated vector contains not only information about the peak point itself but also the context information of the entire sequence before and after it. The context feature vectors of all time steps are arranged in their original chronological order to form a context feature vector sequence.
[0104] In one embodiment, step S420 involves feeding the input feature sequence sequentially into the bidirectional temporal recursive structure layer of the gait phase state transition model. The forward recursive unit of the bidirectional temporal recursive structure layer extracts the forward dependency features of the sequence from front to back, and the backward recursive unit extracts the backward dependency features of the sequence from back to front. The forward and backward dependency features are then concatenated to generate a context feature vector sequence that integrates forward and backward temporal information. Specifically, this may include the following steps S421 to S425: Step S421: Input the feature vector of the first time step in the input feature sequence together with the preset forward initial hidden state into the first gated loop unit of the forward recursive unit, and calculate the forward hidden state vector of the first time step through the update gate and reset gate of the first gated loop unit.
[0105] At the start of forward processing, an initial hidden state is required, for example, set to an all-zero vector. The two-dimensional feature vector of the first time step, along with this zero initial state, is fed into the first gated recurrent unit (GRU). The GRU contains update and reset gates. The update gate controls the degree to which the previous hidden state is incorporated into the current hidden state, while the reset gate controls the degree to which the previous hidden state is ignored. These two gates calculate the new hidden state for the current time step using a nonlinear transformation based on the current input and the hidden state from the previous time step. This new hidden state incorporates information from the current input.
[0106] Step S422: Input the forward hidden state vector of the previous time step and the feature vector of the current time step into each subsequent gated recurrent unit in sequence, update the forward hidden state vector step by step until the last time step of the input feature sequence is processed, and obtain the forward hidden state vector corresponding to each time step to form the forward hidden state sequence.
[0107] After processing the first time step, the first hidden state is obtained. Then, the first hidden state and the feature vector of the second time step are used as inputs to the second gated recurrent unit to calculate the second hidden state. This process is repeated sequentially, updating the hidden state after each time step. After processing the last time step, the forward hidden state vectors from the first to the last time step are obtained. These vectors, arranged in chronological order, form the forward hidden state sequence.
[0108] Step S423: Input the feature vector of the last time step in the input feature sequence together with the preset backward initial hidden state into the second gated loop unit of the backward recursive unit, and update the backward hidden state vector step by step from back to front until the first time step of the input feature sequence is processed, so as to obtain the backward hidden state vector corresponding to each time step to form the backward hidden state sequence.
[0109] The backward processing proceeds in the opposite direction to the forward processing. The initial hidden state of the backward recursion is also set to an all-zero vector. The feature vector of the last time step and the zero initial state are fed into the first gated loop unit of the backward recursion to calculate the backward hidden state corresponding to the last time step. Then, this backward hidden state, together with the feature vector of the second-to-last time step, is input into the next unit to calculate the backward hidden state corresponding to the second-to-last time step. This process continues in reverse until the first time step is processed, obtaining the backward hidden state corresponding to the first time step. This results in a sequence of backward hidden state vectors from the last to the first time step. These vectors are then rearranged according to the forward time index to obtain the backward hidden state vector corresponding to each forward time step, forming a backward hidden state sequence.
[0110] Step S424: For each time step, perform a vector concatenation operation on the forward hidden state vector and the backward hidden state vector corresponding to the same time step to generate a concatenated vector with expanded dimensions. This concatenated vector contains the temporal information before and after the time step.
[0111] For the first time step, concatenate its forward hidden state vector and its corresponding backward hidden state vector. For the second time step, do the same for each time step. The concatenated vector has the dimension of the forward hidden state vector and the backward hidden state vector.
[0112] Step S425: Arrange the concatenated vectors of all time steps in the original time order to obtain the context feature vector sequence.
[0113] The concatenated vectors generated for each time step in step S424 are arranged in chronological order, and the resulting sequence is the context feature vector sequence. Each vector in this sequence contains rich information about its surrounding context.
[0114] Step S430: Input the context feature vector sequence into the attention pooling layer in the gait phase state transition model. Calculate the contribution weight of the context feature vector to phase state discrimination at each time step through the attention pooling layer. Perform a weighted summation of the context feature vector sequence based on the contribution weight to generate a global temporal feature representation focused on key time steps.
[0115] Attention pooling layers are mechanisms that automatically learn which parts of the input sequence are more important for completing the current task and assign higher weights to these parts. For example, each vector in the context feature vector sequence is first mapped to a scalar score through a fully connected layer; this score reflects the importance of that time step. Then, these scores are softmax normalized so that the sum of the scores for all time steps is one, yielding the attention weight for each time step. Next, the context feature vector for each time step is multiplied by its corresponding attention weight to obtain a weighted vector. Finally, the weighted vectors for all time steps are summed element-wise to obtain a single, fixed-dimensional vector. This vector is the global temporal feature representation; it is a condensation of the entire gait cycle feature sequence, but it highlights the information from the peak moments most critical for determining the phase state.
[0116] Step S440: Input the global temporal feature representation into the state decoder in the gait phase state transition model. The state decoder contains a multi-layer nonlinear mapping structure. The global temporal feature representation is mapped into a discrete phase state node sequence through the multi-layer nonlinear mapping structure. Each node in the phase state node sequence corresponds to a specific phase state in the gait cycle.
[0117] A state decoder typically consists of several layers of fully connected neural networks. The global temporal feature representation, as the input vector, first enters the first fully connected layer. This layer maps the input vector to a new space through a linear transformation, and then introduces nonlinearity through a nonlinear activation function such as ReLU, resulting in the output representation of the first layer. This output representation is then input into the second fully connected layer, undergoing similar linear transformations and nonlinear activations, and so on, layer by layer. The output dimension of the final fully connected layer is equal to the predefined total number of phase state categories, with each output value corresponding to the raw score of a category. To obtain the sequence output corresponding to the input time step, the decoder usually needs to incorporate a sequence generation mechanism. One implementation involves first obtaining the probability of each time step belonging to each category through the above mapping, and then using a dynamic programming decoding algorithm such as the Viterbi algorithm to search for the optimal state sequence path across the entire probability matrix, ultimately outputting a phase state label sequence with the same length as the input time step.
[0118] Step S450: Merge consecutive identical phase state nodes in the phase state node sequence, merge adjacent identical phase state nodes into a phase state dwelling segment, extract the start time, end time and phase state label corresponding to each phase state dwelling segment, determine the time sequence between phase state nodes based on the start time and end time, determine the transition direction between adjacent phase state nodes based on the phase state label, and construct the phase state transition path topology composed of phase state nodes and directed transition edges between nodes.
[0119] In the sequence output by step S440, adjacent time steps may correspond to the same phase state. Merging consecutive identical states involves combining consecutively occurring identical state labels into a single node. For example, the state sequence is traversed, recording the current state label and its consecutive start and end indices. When a state label change occurs, the previous consecutive state segment is treated as a node. The start time of this node corresponds to the time represented by the start index, and the end time corresponds to the time represented by the end index. The state label represents the state of that segment. After merging, a series of nodes arranged in chronological order are obtained. Then, based on the order of these nodes, directed transition edges are established between adjacent nodes. The direction of the edges points from the previous node to the next node, and the transition direction is determined by the state labels of the preceding and following nodes. The final structure, containing the nodes, their start and end times, and the directed edges between nodes, represents the phase state transition path topology for that gait cycle.
[0120] Step S500: Perform structural similarity calculation between the phase state transition path topology and multiple reference path topologies in the preset gait pattern library, select the gait category label corresponding to the reference path topology with the highest similarity as the gait category label of the current gait, determine the phase offset based on the node phase offset between the phase state transition path topology and the reference path topology, and output the gait recognition result containing the gait category label and the phase offset.
[0121] The gait pattern library is a pre-built database storing standard phase state transition path topologies corresponding to various typical gait types, each topology with a unique gait category label. Structural similarity calculation compares the similarity between two topologies, focusing on whether the node types, orders, and transition relationships are consistent. Node phase offset refers to the alignment deviation on the time axis between the current gait's phase state transition path topology and the most similar standard reference path topology. For example, firstly, all reference path topologies are retrieved from the gait pattern library. For the phase state transition path topology calculated for the current gait cycle, it is compared with each reference topology in the library. The comparison method calculates the length of the longest common subsequence of the state label sequences corresponding to the two topologies; a longer length indicates greater similarity in state order. If multiple reference topologies have the same longest common subsequence length, the edit distance between the topologies is further calculated; a smaller edit distance indicates closer structures. The reference topology with the highest similarity is selected, and its gait category label is assigned to the current gait. Then, the phase offset between the current topology and the matched reference topology is calculated, typically by comparing the relative time positions of their first phase state nodes. This time difference is then divided by the total duration of the current gait cycle and normalized to a proportional value. Finally, a gait recognition result containing gait category labels and phase offsets is output.
[0122] In one embodiment, step S500 involves performing structural similarity calculations between the phase state transition path topology and multiple reference path topologies in a preset gait pattern library, selecting the gait category label corresponding to the reference path topology with the highest similarity as the gait category label for the current gait, determining the phase offset based on the node phase offset between the phase state transition path topology and the reference path topology, and outputting a gait recognition result containing the gait category label and the phase offset. Specifically, this may include the following steps S510 to S560: Step S510: Extract the node label sequence and the transition direction identifier between adjacent nodes in the phase state transition path topology to form the first topology encoding vector.
[0123] A node label sequence is a list containing only state names, obtained by arranging all phase state nodes in the topology in chronological order. Transition direction identifiers can be implicitly included in the node label order, as the order itself defines the transition from one node to the next. Alternatively, they can be explicitly extracted as a series of directed edges, each containing a source node label and a destination node label. Combining and encoding the node label sequence and transition direction identifiers forms a structured vector or data structure, namely the first topology encoding vector.
[0124] Step S520: Read each reference path topology sequentially from the gait pattern library, extract the node label sequence and transition direction identifier of each reference path topology, and form the second topology encoding vector.
[0125] For each reference topology in the gait pattern library, perform the same operation as in step S510 to extract its node label sequence and transition direction identifier, forming the second topology encoding vector corresponding to that reference topology.
[0126] Step S530: Calculate the length of the longest common subsequence between the first topological coding vector and each second topological coding vector, and determine the reference path topology corresponding to the second topological coding vector with the largest longest common subsequence length as the initial matching topology.
[0127] The longest common subsequence (LCS) is a method for measuring the similarity between two sequences. It does not require that the elements in the LCS are consecutive in the original sequence, only that their order is consistent. The length of the LCS between the node label sequences of the first and second topologically encoded vectors can be calculated using dynamic programming. A longer LCS indicates greater consistency in the types and order of phase states between the two gaits. From all reference topologies, those with the longest LCS are selected as the initial matching topologies.
[0128] In one embodiment, step S530, calculating the length of the longest common subsequence between the first topological coding vector and each second topological coding vector, and determining the reference path topology corresponding to the second topological coding vector with the largest longest common subsequence length as the initial matching topology, may specifically include the following steps S531 to S536: Step S531: Denote the node label sequence in the first topology coding vector as the first sequence, and denote the node label sequence in the second topology coding vector as the second sequence.
[0129] The first sequence is a list of node labels of the current gait phase state transition path topology arranged in chronological order, and the second sequence is a list of node labels of a certain reference path topology arranged in chronological order.
[0130] Step S532: Construct a dynamic programming table. The number of rows in the dynamic programming table is equal to the length of the first sequence plus one, and the number of columns is equal to the length of the second sequence plus one. Initialize the first row and the first column of the dynamic programming table to zero.
[0131] Construct a two-dimensional matrix where the row indices correspond to the element positions in the first sequence, the column indices correspond to the element positions in the second sequence, and the extra row and column are used to handle the case of an empty sequence. Set all elements in the first row and first column to zero.
[0132] Step S533: Traverse the dynamic programming table in row-first, column-second order. For the current position corresponding to the i-th node of the first sequence and the j-th node of the second sequence, if the i-th node and the j-th node have the same label, then the value of the current position is the value of the upper left adjacent position plus one.
[0133] Iterate through all positions in the matrix except the first row and first column. For the current position, compare the label of the i-th node in the first sequence with the label of the j-th node in the second sequence. If the two labels are exactly the same, it means a common node has been found, and the value of the current cell is equal to the value of its top-left adjacent cell plus one.
[0134] Step S534: If the label of the i-th node is different from that of the j-th node, then the value of the current position is the larger of the value of the left adjacent position and the value of the top adjacent position.
[0135] If the labels of the i-th node and the j-th node are different, it means that this pair of nodes cannot be included in the common subsequence at the same time. Therefore, the length of the current longest common subsequence is either equal to the length of the longest common subsequence excluding the i-th node of the first sequence (i.e., the value of the left adjacent cell), or equal to the length of the longest common subsequence excluding the j-th node of the second sequence (i.e., the value of the top adjacent cell). The larger of these two values is taken as the value of the current cell.
[0136] Step S535: After traversing all positions in the dynamic programming table, take the value of the bottom right corner of the dynamic programming table as the length of the longest common subsequence between the first sequence and the second sequence.
[0137] After traversing all rows and columns of the matrix, the value stored in the last cell in the bottom right corner of the matrix is the length of the longest common subsequence of the first sequence and the second sequence.
[0138] Step S536: Repeat the above process to calculate the longest common subsequence length of the first topology encoding vector and the second topology encoding vector corresponding to each reference path topology, and select one or more reference path topologies with the largest longest common subsequence length as the initial matching topology.
[0139] For each reference topology in the gait pattern library, perform steps S531 to S535 to calculate the length of the corresponding longest common subsequence. Then, find the maximum value among these lengths, and all reference topologies that reach this maximum value, and use these topologies as the initial matching topologies.
[0140] Step S540: If multiple reference path topologies have the same longest common subsequence length and all are the maximum value, then further calculate the edit distance between the first topology encoding vector and these candidate reference path topologies, and select the candidate reference path topology with the smallest edit distance as the final matching topology.
[0141] Edit distance measures the minimum number of single-character edit operations required to transform one string into another. These operations include inserting, deleting, and replacing a character. When multiple topologies are equally good in state order (i.e., have the same longest common subsequence length), edit distance can further distinguish their differences in detail, such as whether there are redundant phase nodes, missing phase nodes, or misaligned phase labels. The smaller the edit distance, the closer the overall structure of the two topologies is. Therefore, from these candidate topologies with the largest longest common subsequence lengths, the one with the smallest edit distance to the encoding vector of the first topology is selected as the final matching topology.
[0142] Step S550: Use the gait category label corresponding to the final matched topology as the gait category label of the current gait.
[0143] The label corresponding to the final matching topology selected in step S540 in the gait pattern library is directly assigned to the gait cycle currently being analyzed. This label can be, for example, normal walking, brisk walking, going up stairs, going down stairs, running, etc.
[0144] Step S560: Compare the time position of the first phase state node in the phase state transition path topology with the standard time position of the first phase state node in the final matching topology on the reference time axis, calculate the time difference between the two, and normalize the time difference by the gait period length to obtain the phase offset.
[0145] The first phase state node is typically the starting point of the gait cycle, i.e., the heel position. By comparing the starting node times of these two topologies, we can determine whether the overall phase of the current gait is ahead or behind compared to the standard pattern. Dividing this time difference by the total duration of the current gait cycle yields a proportional value between -1 and +1. For ease of understanding and subsequent processing, this proportional value is usually mapped to the interval between zero and one by adding one and taking the modulus. The resulting normalized proportional value is the phase offset.
[0146] In one embodiment, step S560 compares the time position of the first phase state node in the phase state transition path topology with the standard time position of the first phase state node in the final matching topology on the reference time axis, calculates the time difference between the two, and normalizes the time difference by the gait cycle length to obtain the phase offset. Specifically, this may include the following steps S561 to S565: Step S561: Extract the timestamp corresponding to the first phase state node in the phase state transition path topology as the first time value, and extract the standard time position of the first phase state node in the final matching topology in the standard gait cycle template as the second time value.
[0147] The first time value is the absolute timestamp or relative time value relative to the start of the cycle when the first phase state node in the current gait cycle occurs, i.e., the heel strike event. The second time value is the time position of the first phase state node in the standard reference topology, which is usually defined as zero or the start point of the cycle in the standard template.
[0148] Step S562: Calculate the difference between the first time value and the second time value to obtain the initial time offset.
[0149] Subtracting the second time value from the first time value yields a time difference value. This difference value can be positive or negative. A positive value indicates that the current gait phase is lagging behind the standard template, while a negative value indicates that it is ahead.
[0150] Step S563: Obtain the gait cycle duration length corresponding to the current gait cycle unit, and use the gait cycle duration length as the normalization benchmark.
[0151] The duration of a gait cycle is the length of that cycle window, which is the time interval from the heel strike to the next heel strike.
[0152] Step S564: Divide the initial time offset by the gait cycle duration to obtain the dimensionless relative offset ratio.
[0153] Divide the initial time offset by the gait cycle duration to obtain a ratio, which represents the proportion of the offset to the entire cycle length.
[0154] Step S565: Map the relative offset ratio value to a closed interval between zero and one. If the relative offset ratio value is negative, add one to make it fall into the interval between zero and one. Output the mapped relative offset ratio value as the phase offset, which together with the gait category label constitutes the gait recognition result.
[0155] If the relative offset ratio is already between zero and one, it is directly used as the phase offset. If the relative offset ratio is negative, it indicates that the current gait phase is ahead, so it is incremented by one and mapped to the zero-to-one interval. Finally, the gait category label and the mapped phase offset are combined to form a complete gait recognition result output.
[0156] The following description continues to illustrate the exemplary structure of the gait recognition device 255 in the application scenario provided in this application embodiment as a software module. In some embodiments, such as... Figure 2 As shown, the software module in the skill release device 255 stored in the virtual scene of the memory 450 may include: The data acquisition module 2551 is used to acquire the raw electromyographic signal stream collected by the electromyographic sensor and the raw inertial signal stream collected by the inertial sensor, perform acquisition time axis alignment processing on the raw electromyographic signal stream and the raw inertial signal stream to eliminate time delay differences, and perform signal quality screening processing to remove signal segments whose signal quality does not meet the preset requirements, so as to obtain synchronized electromyographic-inertial data stream. The event detection module 2552 is used to detect gait event trigger points in the synchronized electromyography-inertial data stream, identify heel strike event points and toe lift-off event points in the gait cycle, and segment the synchronized electromyography-inertial data stream according to the heel strike event points and toe lift-off event points to generate a set of gait cycle units in gait cycle units. The feature extraction module 2553 is used to extract the envelope features of the electromyographic signal segments contained in each gait cycle unit in the gait cycle unit set, and to extract the posture angle change sequence of the contained inertial signal segments. The envelope features of the electromyographic signal segments and the posture angle change sequence of the inertial signal segments are correlated and analyzed to obtain the electromyographic-inertial coupling activation mode descriptor that reflects the synergistic relationship between electromyographic activity and inertial motion. The topology generation module 2554 is used to call the pre-built gait phase state transition model to perform phase transition path reasoning on the electromyography-inertial coupling activation mode descriptor. The gait phase state transition model is configured with a time recursive structure. Based on the time evolution trend of the electromyography-inertial coupling activation mode descriptor, it generates the phase state nodes that appear successively in the gait cycle and the transition direction between the phase state nodes, thus obtaining the phase state transition path topology. The gait recognition module 2555 is used to perform structural similarity calculation between the phase state transition path topology and multiple reference path topologies in the preset gait pattern library, select the gait category label corresponding to the reference path topology with the highest similarity as the gait category label of the current gait, determine the phase offset based on the node phase offset between the phase state transition path topology and the reference path topology, and output the gait recognition result containing the gait category label and the phase offset.
[0157] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A gait recognition method based on the fusion of electromyography and inertial data, characterized in that, The method includes: The raw electromyographic signal stream acquired by the electromyographic sensor and the raw inertial signal stream acquired by the inertial sensor are acquired. The raw electromyographic signal stream and the raw inertial signal stream are aligned by the acquisition time axis to eliminate time delay differences, and the signal quality is filtered to remove signal segments that do not meet the preset requirements, so as to obtain a synchronized electromyographic-inertial data stream. The synchronized electromyography-inertial data stream is subjected to gait event trigger point detection, the heel strike event point and the toe lift event point in the gait cycle are identified, and the synchronized electromyography-inertial data stream is segmented according to the heel strike event point and the toe lift event point to generate a set of gait cycle units with gait cycle as the unit. Envelope features are extracted from the electromyographic signal segments contained in each gait cycle unit in the gait cycle unit set, and posture angle change sequences are extracted from the contained inertial signal segments. The envelope features of the electromyographic signal segments and the posture angle change sequences of the inertial signal segments are correlated and analyzed to obtain an electromyographic-inertial coupling activation mode descriptor that reflects the synergistic relationship between electromyographic activity and inertial motion. The pre-built gait phase state transition model is invoked to perform phase transition path reasoning on the electromyography-inertial coupling activation mode descriptor. The gait phase state transition model is configured with a time recursive structure. Based on the time evolution trend of the electromyography-inertial coupling activation mode descriptor, the phase state nodes that appear successively in the gait cycle and the transition direction between the phase state nodes are generated to obtain the phase state transition path topology. The structural similarity calculation is performed between the phase state transition path topology and multiple reference path topologies in the preset gait pattern library. The gait category label corresponding to the reference path topology with the highest similarity is selected as the gait category label of the current gait. The phase offset is determined according to the node phase offset between the phase state transition path topology and the reference path topology. The gait recognition result containing the gait category label and the phase offset is output.
2. The gait recognition method based on electromyography and inertial data fusion according to claim 1, characterized in that, The synchronized electromyography-inertial data stream is subjected to gait event trigger point detection, identifying heel strike and toe-off event points in the gait cycle, and segmenting the synchronized electromyography-inertial data stream based on the heel strike and toe-off event points to generate a set of gait cycle units, including: Energy calculations are performed on the electromyographic signals in the synchronized electromyographic-inertial data stream to obtain the electromyographic energy envelope curve, and local maxima in the electromyographic energy envelope curve are detected as preliminary candidate points for heel strike. The acceleration magnitude of the inertial signal in the synchronized electromyography-inertial data stream is calculated, and the zero-crossing point and trough point of the acceleration magnitude curve are detected as preliminary toe-off candidate points and preliminary heel-off supplementary points. The initial heel strike candidate points, the initial toe lift candidate points, and the initial heel strike supplementary points are checked for consistency in time sequence. Abnormal candidate points that do not conform to the gait movement timing logic are eliminated to obtain the effective heel strike event point sequence and the effective toe lift event point sequence. A gait cycle segmentation window is constructed based on the effective heel strike event point sequence and the effective toe-off event point sequence. The time interval between two adjacent heel strike event points is used as a gait cycle window, and heel strike event points and toe-off event points are identified as intermediate key event points within each gait cycle window. The synchronized electromyography-inertial data stream is sliced according to the gait cycle window to generate electromyography signal subsequence and inertial signal subsequence corresponding to each gait cycle window. The start point, end point and internal key event points of each gait cycle window are marked to obtain the gait cycle unit set.
3. The gait recognition method based on electromyography and inertial data fusion according to claim 2, characterized in that, The process of performing a temporal sequence consistency check on the initial heel strike candidate points, the initial toe-off candidate points, and the initial heel strike supplementary points, and eliminating abnormal candidate points that do not conform to the gait movement temporal logic, yields a valid heel strike event point sequence and a valid toe-off event point sequence, including: The preliminary heel-landing candidate points and the preliminary heel-landing supplementary points are merged and deduplicated to generate a set of heel-landing candidate points; Based on the alternating occurrence of heel strike events and toe-off events during gait, an event time sequence constraint is constructed. The event time sequence constraint stipulates that there is a toe-off event between adjacent heel strike event points and that the toe-off event point is located between two heel strike event points. Traverse the set of candidate heel landing points and the initial candidate toe lifting points in chronological order, and check in turn whether each candidate point satisfies the event chronological order constraint. Candidate points that violate the event time sequence constraints are marked as abnormal candidate points and removed, while candidate points that satisfy the event time sequence constraints are retained as valid event points. Neighborhood redundancy removal is performed on the effective event points to ensure that only one heel strike event point and one toe lift event point are retained in each gait cycle, thus obtaining the effective heel strike event point sequence and the effective toe lift event point sequence.
4. The gait recognition method based on electromyography and inertial data fusion according to claim 2, characterized in that, The synchronized electromyography-inertial data stream is sliced according to the gait cycle window to generate an electromyography signal subsequence and an inertial signal subsequence corresponding to each gait cycle window. The start point, end point, and internal key event points of each gait cycle window are marked to obtain the gait cycle unit set, including: The start point time index and end point time index of each gait cycle window are extracted, and the corresponding original electromyographic data segments and original inertial data segments are extracted from the synchronized electromyographic-inertial data stream according to the start point time index and the end point time index to obtain the initial gait cycle slice data package. The original electromyography (EMG) data segments in the initial gait cycle slice data package are subjected to bandpass filtering to retain the effective frequency band components of the EMG signal, and adaptive noise cancellation is performed to remove motion artifact interference, generating a purified EMG signal subsequence. Zero-bias stability estimation is performed on the original inertial data segment in the initial gait cycle slice data packet. The offset compensation is performed on the original inertial data segment based on the estimated zero-bias value. The coordinate system is aligned on the compensated inertial data, and the data in the sensor coordinate system is transformed to the global reference coordinate system to generate a calibrated inertial signal subsequence. The purified electromyographic signal subsequence and the calibrated inertial signal subsequence are realigned on the time axis, and the time synchronization deviation between them is checked. If there is a time deviation, the sampling time points of the two are made to correspond completely by interpolation and resampling, and a time-synchronized electromyographic-inertial paired data unit is generated. Structured description information is added to the electromyography-inertial pairing data unit. The structured description information includes the start time stamp of the gait cycle window, the end time stamp of the gait cycle window, the relative time offset of the heel strike event point within the gait cycle window, and the relative time offset of the toe lift-off event point within the gait cycle window. The electromyography-inertial pairing data unit with added structured description information is used as the complete gait cycle unit, and all gait cycle units corresponding to all gait cycle windows are collected into the gait cycle unit set.
5. The gait recognition method based on electromyography and inertial data fusion according to claim 4, characterized in that, The process involves realigning the purified electromyographic signal subsequence and the calibrated inertial signal subsequence on the time axis, checking for time synchronization deviations between them, and if a time deviation exists, interpolating and resampling to ensure that the sampling time points of the two are completely aligned, thereby generating a time-synchronized electromyographic-inertial paired data unit. This includes: Extract the sampling timestamp sequence of the purified electromyographic signal subsequence and the sampling timestamp sequence of the calibrated inertial signal subsequence, calculate the start time difference and the end time difference between the two sets of sampling timestamp sequences, and determine that the two are synchronized if both the start time difference and the end time difference are less than a preset time threshold. If the purified electromyographic signal subsequence is not synchronized with the calibrated inertial signal subsequence, then the signal subsequence with the higher sampling rate is determined as the reference sequence, and the signal subsequence with the lower sampling rate is determined as the sequence to be adjusted. Spline interpolation is performed on the sequence to be adjusted to generate an interpolated signal value that completely corresponds to the sampling timestamp of the reference sequence, so that the number of sampling points of the sequence to be adjusted is consistent with the number of sampling points of the reference sequence. Anti-aliasing filtering is applied to the interpolated sequence to be adjusted to eliminate high-frequency noise components introduced by interpolation, resulting in an adjusted signal subsequence aligned with the time axis of the reference sequence. The reference sequence and the adjusted signal subsequence are paired and encapsulated to generate time-synchronized electromyographic-inertial paired data units, in which each sampling point on the time axis simultaneously contains electromyographic signal values and inertial signal values.
6. The gait recognition method based on electromyography and inertial data fusion according to claim 1, characterized in that, The process involves extracting envelope features from the electromyographic (EMG) signal segments contained in each gait cycle unit within the gait cycle unit set, extracting posture angle change sequences from the included inertial signal segments, and performing correlation analysis between the envelope features of the EMG signal segments and the posture angle change sequences of the inertial signal segments to obtain an EMG-inertial coupling activation mode descriptor reflecting the synergistic relationship between EMG activity and inertial motion, including: The electromyographic signal segments in the gait cycle unit are subjected to full-wave rectification. The rectified electromyographic signals are smoothed by passing them through a low-pass filter. A linear envelope curve reflecting the overall intensity of electromyographic activity is extracted. The amplitude of the linear envelope curve is normalized to obtain the electromyographic envelope feature sequence. The triaxial acceleration data and triaxial angular velocity data in the inertial signal segment of the gait cycle unit are subjected to complementary filtering and fusion to obtain the quaternion of the carrier coordinate system relative to the navigation coordinate system. The quaternion is converted into the roll angle sequence, pitch angle sequence and yaw angle sequence in Euler angle form. The roll angle sequence, pitch angle sequence and yaw angle sequence are subjected to differential operation to obtain the angular velocity change trend sequence as the attitude angle change sequence. The electromyographic envelope feature sequence and the posture angle change sequence are input into a pre-constructed coupling analysis window. The coupling analysis window slides on the time axis at a fixed time length, and at each sliding position, a local segment of the electromyographic envelope feature sequence and a local segment of the posture angle change sequence are extracted. At each sliding position, the fractal dimension of a local segment of the electromyographic envelope feature sequence is calculated to obtain an electromyographic complexity index. The sample entropy of a local segment of the attitude angle change sequence is calculated to obtain an inertial motion regularity index. The Pearson correlation coefficient between the electromyographic complexity index and the inertial motion regularity index is calculated to obtain a local coupling strength value. The local coupling strength values are arranged in chronological order to form a coupling strength evolution curve. Peak detection is performed on the coupling strength evolution curve to extract the amplitude of the peak point and its corresponding time position. The amplitude sequence and time position sequence of the peak point are combined to form the electromyography-inertial coupling activation mode descriptor.
7. The gait recognition method based on electromyography and inertial data fusion according to claim 6, characterized in that, The step involves inputting the electromyographic envelope feature sequence and the posture angle change sequence into a pre-constructed coupling analysis window. The coupling analysis window slides along the time axis at fixed time intervals, extracting local segments of the electromyographic envelope feature sequence and the posture angle change sequence at each sliding position. This includes: The time length parameter and sliding step size parameter of the preset coupling analysis window are set. The time length parameter is greater than half of the average duration of a gait cycle unit and less than the average duration of a gait cycle unit. The sliding step size parameter is less than the time length parameter to ensure that there is an overlapping area between adjacent windows. Starting from the common starting point of the electromyographic envelope feature sequence and the posture angle change sequence, the starting position of the coupling analysis window is gradually moved according to the sliding step size parameter; At each current sliding position, the termination position of the coupling analysis window is determined according to the time length parameter. All electromyographic envelope feature values within the range from the current sliding position to the termination position are extracted from the electromyographic envelope feature sequence to form a local segment of the electromyographic envelope feature sequence. All posture angle change values within a time range that completely correspond to a local segment of the electromyographic envelope feature sequence are synchronously extracted from the posture angle change sequence to form a local segment of the posture angle change sequence; The local segments of the electromyographic envelope feature sequence and the local segments of the posture angle change sequence are paired to generate a local coupling analysis data pair corresponding to the current sliding position, which is used for subsequent calculation of the local coupling strength value.
8. The gait recognition method based on electromyography and inertial data fusion according to claim 6, characterized in that, The process involves arranging the local coupling strength values in chronological order to form a coupling strength evolution curve, performing peak detection on the coupling strength evolution curve, extracting the amplitude of the peak points and their corresponding time positions, and combining the amplitude sequence and time position sequence of the peak points into the electromyographic-inertial coupling activation mode descriptor, including: The local coupling strength values calculated at each sliding position are sorted according to the center time point of the corresponding sliding window to generate the coupling strength evolution curve with time as the horizontal axis and coupling strength value as the vertical axis. The first derivative of the coupling strength evolution curve is calculated to obtain the curve slope change sequence, and the zero-crossing point of the curve slope change sequence from positive to negative is detected as the candidate peak point position. For each candidate peak point location, its coupling strength value is compared with the coupling strength values of the two adjacent left and right sampling points. If the coupling strength value of the candidate peak point location is greater than the coupling strength values of the two adjacent left and right sampling points, it is confirmed as a valid peak point. Extract the coupling strength value of each effective peak point as the peak point amplitude, and extract the time point corresponding to each effective peak point as the peak point time position; Arrange the peak amplitudes of all valid peak points in chronological order to form a peak amplitude sequence, arrange the peak time positions of all valid peak points in chronological order to form a peak time sequence, and associate the peak amplitude sequence with the peak time sequence to generate the electromyographic-inertial coupling activation mode descriptor.
9. The gait recognition method based on electromyography and inertial data fusion according to claim 1, characterized in that, The process involves invoking a pre-built gait phase state transition model to perform phase transition path inference on the electromyography-inertial coupling activation mode descriptor. The gait phase state transition model internally configures a time recursive structure, generating sequentially occurring phase state nodes within the gait cycle and the transition directions between these phase state nodes based on the temporal evolution trend of the electromyography-inertial coupling activation mode descriptor, thus obtaining the phase state transition path topology, including: The peak amplitude sequence and peak time sequence in the electromyography-inertial coupling activation mode descriptor are fused to generate a joint feature vector containing amplitude and time information, and the joint feature vector is arranged in chronological order to form an input feature sequence. The input feature sequence is sequentially fed into the bidirectional temporal recursive structure layer in the gait phase state transition model. The forward recursive unit of the bidirectional temporal recursive structure layer extracts the forward dependency features of the sequence from front to back, and the backward recursive unit of the bidirectional temporal recursive structure layer extracts the backward dependency features of the sequence from back to front. The forward dependency features and the backward dependency features are concatenated to generate a context feature vector sequence that integrates forward and backward temporal information. The context feature vector sequence is input into the attention pooling layer in the gait phase state transition model. The attention pooling layer calculates the contribution weight of the context feature vector at each time step to the phase state discrimination. The context feature vector sequence is weighted and summed according to the contribution weight to generate a global temporal feature representation focusing on key time steps. The global temporal feature representation is input into the state decoder in the gait phase state transition model. The state decoder contains a multi-layer nonlinear mapping structure, which maps the global temporal feature representation into a discrete phase state node sequence. Each node in the phase state node sequence corresponds to a specific phase state in the gait cycle. The sequence of phase state nodes is merged with consecutive identical states, and adjacent identical phase state nodes are merged into a phase state dwelling segment. The start time, end time and phase state label corresponding to each phase state dwelling segment are extracted. The time sequence between phase state nodes is determined according to the start time and end time, and the transition direction between adjacent phase state nodes is determined according to the phase state label. The phase state transition path topology composed of phase state nodes and directed transition edges between nodes is constructed.
10. A gait recognition device, characterized in that, The device includes: The data acquisition module is used to acquire the raw electromyographic signal stream collected by the electromyographic sensor and the raw inertial signal stream collected by the inertial sensor. The raw electromyographic signal stream and the raw inertial signal stream are aligned on the acquisition time axis to eliminate time delay differences, and the signal quality is filtered to remove signal segments that do not meet the preset requirements, so as to obtain a synchronized electromyographic-inertial data stream. The event detection module is used to detect gait event trigger points in the synchronized electromyography-inertial data stream, identify heel strike event points and toe lift-off event points in the gait cycle, and segment the synchronized electromyography-inertial data stream according to the heel strike event points and toe lift-off event points to generate a set of gait cycle units based on the gait cycle. The feature extraction module is used to extract the envelope features of the electromyographic signal segments contained in each gait cycle unit in the gait cycle unit set, and to extract the posture angle change sequence of the contained inertial signal segments. The envelope features of the electromyographic signal segments and the posture angle change sequence of the inertial signal segments are correlated and analyzed to obtain an electromyographic-inertial coupling activation mode descriptor that reflects the synergistic relationship between electromyographic activity and inertial motion. The topology generation module is used to call a pre-built gait phase state transition model to perform phase transition path reasoning on the electromyography-inertial coupling activation mode descriptor. The gait phase state transition model is configured with a time recursive structure, and generates phase state nodes that appear successively in the gait cycle and the transition direction between the phase state nodes according to the time evolution trend of the electromyography-inertial coupling activation mode descriptor, so as to obtain the phase state transition path topology. The gait recognition module is used to perform structural similarity calculation between the phase state transition path topology and multiple reference path topologies in a preset gait pattern library, select the gait category label corresponding to the reference path topology with the highest similarity as the gait category label of the current gait, determine the phase offset based on the node phase offset between the phase state transition path topology and the reference path topology, and output the gait recognition result containing the gait category label and the phase offset.