Muscle deformation signal and exoskeleton joint angle mapping system and method

Through the human-machine collaboration system based on the Transformer model, the shortcomings of muscle deformation signals and exoskeleton joint angle mapping in the existing technology are solved, and fast and accurate data acquisition and analysis are achieved, which improves the accuracy and reliability of the model and ensures that Data quality and consistency.

CN119033567AActive Publication Date: 2024-11-29SHANGHAI UNIV

Patent Information

Application Number
CN202411152686.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-11-29
Estimated Expiration
2044-08-21

AI Technical Summary

Technical Problem

In the field of medical rehabilitation and intelligent auxiliary equipment, it is difficult to quickly and accurately obtain the mapping of human muscle deformation signals and exoskeleton joint angles, resulting in insufficient data timeliness and usability, affecting the accuracy and reliability of the model.

Method used

Using a human-machine collaboration system based on the Transformer model, muscle deformation signals are collected through sensor modules, multi-head attention mechanism and multi-layer perceptrons are used to process and analyze the data characteristics, and combined with exoskeleton devices for exercise assistance to realize muscle deformation signals and external Accurate mapping of bone joint angles.

Benefits of technology

It realizes rapid acquisition and analysis of data, ensures data quality and consistency, accurately infers the knee joint angle from muscle deformation data, verifies the accuracy of exoskeleton motor parameters, and improves the model's perception and feature expression capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119033567A_ABST
    Figure CN119033567A_ABST
Patent Text Reader

Abstract

The invention provides a mapping system and method for muscle deformation signals and exoskeleton joint angles, and the method comprises the steps: carrying out the three-time linear transformation of a vector of each position in an input sequence through employing a transformer multi-head self-attention algorithm, and extracting the related features of data. Five muscle deformation variables around the knee joint knee pad are extracted and mapped with the angle of the knee joint of the human body, and accurate prediction of the angle of the knee joint is achieved. According to the invention, data can be rapidly collected and analyzed, and offline use can be realized. The knee joint knee pad surrounding muscle deformation data is generated by adopting a specific method and is mapped with the angle of the human knee joint, so that the quality and the consistency are ensured. Original signal coding dimension raising and dimension reduction are fused, knee joint function evaluation is achieved in combination with a multi-layer sensor, and the angle of the knee joint is accurately deduced from muscle deformation data. And muscle deformation data are serialized, so that model processing and analysis are facilitated. The accuracy of an exoskeleton motor parameter verification algorithm is determined through data collected by the flexible sensor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of medical rehabilitation and intelligent auxiliary equipment, and in particular to a transformer-based mapping system and method for human knee joint muscle deformation signals and exoskeleton joint angles. Background Art

[0002] In the field of medical rehabilitation and intelligent assistive devices, it is of great significance to accurately obtain human muscle deformation signals and accurately map them to the exoskeleton joint angles. Previous technologies were slow in data acquisition and it was difficult to obtain muscle deformation information in real time and quickly, resulting in insufficient timeliness and availability of data. In data analysis and processing, there is a lack of efficient algorithms and models, making it difficult to accurately extract key features from muscle deformation data and unable to accurately infer knee joint angles.

[0003] At the same time, the data generation method lacks pertinence and standardization, resulting in uneven data quality and difficulty in ensuring consistency, which affects the accuracy and reliability of the model. In addition, the organization of muscle deformation data is not reasonable enough, which is not conducive to model processing and analysis. In terms of determining the exoskeleton motor parameters, there is also a lack of effective data support and accurate verification methods, making it difficult to fully guarantee the accuracy of the algorithm.

[0004] In summary, the existing technology has many deficiencies in the mapping of muscle deformation signals to exoskeleton joint angles, and cannot fully play the role of exoskeleton devices in assisting movement and rehabilitation. An innovative system and method are urgently needed to solve these problems. Summary of the invention

[0005] In view of the defects in the prior art, the present invention aims to establish a human-machine collaborative Transformer model, a system and method for generating muscle deformation data around the knee brace and mapping it with the angle of the human knee joint.

[0006] A mapping system of muscle deformation signals and exoskeleton joint angles provided by the present invention includes: a sensor module, a Transformer model, an exoskeleton device, a control module, a communication module, a motor drive module and a harmonic reducer;

[0007] Sensor module, used to collect muscle deformation signals;

[0008] The Transformer model is used to process the features of the received muscle deformation signals using a multi-head attention mechanism, and then train and analyze the processed features and knee joint angles in combination with a multi-layer perceptron.

[0009] Exoskeleton devices are used to assist human joint movements;

[0010] After the sensor module collects the muscle deformation signal, it is sent to the control module through the communication module, and then input into the Transformer model to obtain the output result. The control module then sends the output result to the motor drive module through the communication module. The motor drive module controls the harmonic reducer to drive the exoskeleton device to move.

[0011] Preferably, the sensor module includes five distributed strain sensors arranged on the knee pad body, the sensor includes a stretchable base layer and a stretchable conductor unit, the stretchable base layer is laid on the knee pad body, and the stretchable conductor unit is used to produce electrical performance changes following the deformation of the stretchable base layer.

[0012] Preferably, the data processing flow of the Transformer model is as follows: first, the data is encoded and processed, and the encoded data after dimension upgrade is transmitted to the encoder. In the encoder, the data features are calculated through a multi-head self-attention mechanism. After the feature calculation is completed, it is combined with the knee joint angle information and trained and analyzed using a multi-layer perceptron neural network;

[0013] The algorithm process includes data dimensionality increase, multi-head self-attention calculation, layer normalization and residual connection, data dimensionality reduction, data fusion and multi-layer perceptron;

[0014] The encoder includes multiple stacked encoder layers, each of which includes a multi-head self-attention mechanism, layer normalization, and residual connection operations. Each attention head of the multi-head self-attention mechanism calculates different attention weights, thereby capturing the correlation between different parts of the input data.

[0015] Preferably, the exoskeleton device comprises an ultra-flat joint actuator consisting of four DC brushless outer rotor disc motors, the ultra-flat joint actuator is equipped with a Hall sensor and a harmonic reducer of matching size, and the ultra-flat joint actuator is powered by a 24V DC voltage;

[0016] The ultra-flat joint actuators correspond one-to-one to the positions of each major joint. In the lower limb part, two ultra-flat joint actuators are arranged at each left and right hip joints, and one ultra-flat joint actuator is arranged at each left and right knee joints.

[0017] Preferably, the upper computer of the control module adopts a PC, the lower computer adopts a single-chip microcomputer STM32F103VET6, and the communication module adopts CAN Open communication and serial port communication; the control process of the control module is: after the sensor module collects the muscle deformation signal, it sends the data to the PC through the serial port, inputs the data into the Transformer model, and after solving the angle, the PC sends the data to the single-chip microcomputer STM32F103VET6 through the serial port, and the single-chip microcomputer sends the data to the motor drive module through CAN Open communication, so that the motor drive module controls the harmonic reducer for transmission.

[0018] The present invention provides a method for mapping muscle deformation signals to exoskeleton joint angles, and uses the above-mentioned mapping system for muscle deformation signals to exoskeleton joint angles, comprising the following steps:

[0019] S1, extracting feature data from the input muscle deformation signal to obtain key feature vectors;

[0020] S2, uses a multi-head attention layer to process the key feature vector to obtain the feature representation of the focused part;

[0021] S3, performing layer-by-layer normalization on the feature representation to obtain normalized feature data;

[0022] S4, using residual connection to add the feature representation and feature data to obtain added feature data;

[0023] S5, performing data dimensionality reduction on the added feature data to obtain dimensionality-reduced data;

[0024] S6, enhancing the features after dimensionality reduction to obtain increased data;

[0025] S7, performing data mapping based on the added data to obtain a mapping result between the muscle deformation signal and the exoskeleton joint angle.

[0026] Preferably, in step S1, the input muscle deformation signal is {a1, a2, a3, a4, a5}, where a1 to a5 are data contents, which are integer data;

[0027] Transpose the data {a1, a2, a3, a4, a5} to (a1, a2, a3, a4, a5) T A matrix with five rows and one column is multiplied by a matrix with one row and n columns of trainable coefficients to obtain matrix A. The formula is as follows:

[0028]

[0029] In matrix A, each row element abstractly expresses its original data through a coefficient matrix.

[0030] Preferably, in step S2, the self-attention mechanism is implemented by three matrices (query matrix Q, key matrix K, value matrix V); the input is a matrix containing a sequence, usually represented as (X) (shape is ((n, d)), where (n) is the sequence length and (d) is the feature dimension), and the input is transformed through three different linear transformations to obtain the query matrix (Q), key matrix (K) and value matrix (V). The expression formula of the attention mechanism is:

[0031]

[0032] Among them, Q (Query), K (Key), V (Value) are input vectors. The formula represents linear transformation of K and V, then calculating the dot product of Q and K, obtaining the attention weight after softmax normalization, and then multiplying it with V to obtain the final output;

[0033] The multi-head self-attention mechanism is an extension of the self-attention mechanism. The input vectors Q (Query), K (Key), and V (Value) are linearly transformed into multiple heads respectively. The dimension of each head is reduced, usually d / h, where d is the dimension of the input vector and h is the number of heads. The process of the multi-head self-attention mechanism includes the following steps:

[0034] Step 1: Each head calculates the attention mechanism independently;

[0035] Step 2: Concatenate the outputs of all heads and perform linear transformation to obtain the final output;

[0036] The formula is:

[0037] MultiHead(Q,K,V)=Concat(head1,head2,...,head n )W o (3)

[0038] The calculation process of each head is:

[0039] head i =Attention(Q i , K i , V i )#(4)

[0040] Perform multi-head self-attention calculation on the upgraded data, and multiply the upgraded matrix A by three different linear transformation matrices W Q , W K , W V , thus obtaining three matrices Q, K, and V, the formula is as follows:

[0041]

[0042] Among them, the three matrices Q, K, and V are 5-row and m-column matrices, and the value of m should be an integer multiple of the number of heads;

[0043] Then split the three matrices Q, K, and V. The number of matrices after splitting is the corresponding number of heads. Split the matrix into h heads, and the number of columns of each matrix should be The corresponding formula is as follows:

[0044]

[0045] As shown above, the three matrices Q, K, and V are split into h heads to obtain Q1, ...Q h ,K1,…K h ,V1,…V h , these matrices are respectively calculated by self-attention weight to obtain the matrix Z. According to the self-attention calculation formula, first Q1,…Q h ,K1,…K h Multiply them separately, the formula is as follows:

[0046]

[0047] The obtained matrix is ​​subjected to softmax transformation, and we have:

[0048]

[0049] Among them, we perform softmax normalization on the row elements of the matrix so that the sum of each row element is 1, and we have

[0050]

[0051]

[0052] Let's talk about the matrix dot multiplication V after softmax transformation, we have:

[0053]

[0054] in,

[0055] In multi-head attention calculation, the Q of each head i , K i , V i All need to perform self-attention calculations to obtain the matrix Z i , and finally the matrix Z of each head will be obtained i Splice them together to get the matrix Z and complete the multi-head self-attention calculation. The formula is as follows:

[0056]

[0057] Preferably, in step S3, the layer normalization formula used is as follows:

[0058]

[0059] Where E(x) is the mean value of x, σ(x) is the standard deviation of x, ε is a very small number to prevent the denominator from being 0; γ and β are learnable parameters;

[0060] After the multi-head attention calculation is completed, we need to normalize each row of the matrix. The formula is as follows:

[0061]

[0062] in, for:

[0063]

[0064] According to the layer normalization formula, γ is 1, β is 0, and ε is (1e-6), which is 10 to the power of -6. 1e-6 is scientific notation, that is, 1 times 10 to the power of -6.

[0065] Preferably, in step S4, the layer normalized The matrix is ​​added to the initial dimension-upgraded A matrix. is a matrix with 1 row and m columns, A is a matrix with 1 row and n columns, let n = m, the matrix after the output of the multi-head attention layer does not need to be multiplied by W o The matrix undergoes dimension transformation, and the residual connection formula is as follows:

[0066]

[0067] In step S5, The data is reduced to one row and five columns, and the formula is as follows:

[0068]

[0069] Then the C matrix is ​​the matrix after dimensionality reduction;

[0070] Step S6, after the data output by the encoder is processed by dimensionality reduction, the features after dimensionality reduction are added to the original data, i.e., feature enhancement, the formula is as follows:

[0071] (a1,a2,a3,a4,a5)+(c1,c2,c3,c4,c5)=(α1,α2,α3,α4,α5) (21)

[0072] Step S7, combining the result output by the encoder with the knee angle and transmitting it to a multi-layer perceptron for training and analysis to achieve knee joint function assessment;

[0073] The activation function selects the leaky_relu function:

[0074]

[0075] If the input x is greater than 0, the output is x; if the input x is less than or equal to 0, the output is α times the input;

[0076] Let the knee angle be y, and form a neural network with the data output by the encoder. The formula is as follows:

[0077]

[0078] Compared with the prior art, the present invention has the following beneficial effects:

[0079] 1. The present invention establishes a human-machine collaborative Transformer model, which can quickly collect data, quickly analyze data, and can be used offline.

[0080] 2. The present invention adopts a specific training data generation method to generate muscle deformation data around the knee brace and map it with the angle of the human knee joint to ensure the quality and consistency of the data.

[0081] 3. The present invention encodes the original signal and upgrades its dimension, uses a multi-head attention algorithm to extract features from the encoded muscle change signal, fuses it with the original data after dimensionality reduction, and combines a multi-layer perceptron (MLP) to train and analyze the extracted features and the knee joint angle, thereby achieving accurate knee joint function assessment, allowing it to accurately infer the knee joint angle from the muscle deformation data.

[0082] 4. The present invention converts muscle deformation data from original time domain signals into serialization, so that the model can better process and analyze data.

[0083] 5. The present invention can determine the precise parameters of the exoskeleton motor through data collection by flexible sensors, thereby verifying the accuracy of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0084] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0085] Figure 1 is an overall flow chart of the transformer-based human-machine collaborative model in an embodiment of the present invention;

[0086] Figure 2 It is a flowchart of the algorithm of multi-head attention in an embodiment of the present invention;

[0087] Figure 3 A flexible sensor for measuring human muscle deformation in an embodiment of the present invention;

[0088] Figure 4 is a structural diagram of an exoskeleton device in an embodiment of the present invention;

[0089] Figure 5 is a control flow chart in an embodiment of the present invention;

[0090] Figure 6 A physical diagram of a mapping system between muscle deformation signals and exoskeleton joint angles in an embodiment of the present invention;

[0091] Figure 7 It is an overall driving flow chart in an embodiment of the present invention. DETAILED DESCRIPTION

[0092] The present invention introduces the transformer multi-head attention mechanism, and weights the importance of different parts of the features respectively, thereby improving the perception ability and feature expression ability of the model, thereby realizing the coordinated movement of human muscles and exoskeleton joint angles. Among them, the multi-head self-attention mechanism can improve the detection accuracy of target detection networks such as Faster R-CNN, reduce missed detection and false detection, and thus establish a human-machine collaborative Transformer model. By extracting five muscle deformation variables around the knee brace and corresponding to the angle of the human knee joint, accurate prediction of the knee joint angle is achieved. First, we collected large-scale muscle deformation data and knee joint angle data around the knee brace, and performed strict data preprocessing on them to ensure the quality and consistency of the data. Then, feature extraction is performed on the muscle change signal around the knee joint, and the extracted features and knee joint angles are trained and analyzed in combination with a multi-layer perceptron (MLP), so as to realize the inference of the knee joint angle from the muscle deformation data. Finally, through experimental testing, the muscle deformation data can be mapped to the exoskeleton joint angle, and the data collection and prediction of the experimental test part are completed.

[0093] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0094] Embodiment 1:

[0095] Figure 1This is an overall flow chart of the transformer-based human-computer collaboration model in an embodiment of the present invention.

[0096] like Figure 1 As shown, the embodiment of the present invention converts the muscle motion signal around the knee into an angle, extracts features of the muscle change signal around the knee joint by using the multi-head attention mechanism in the Transformer encoder module, and performs feature enhancement. Then, the enhanced features and the knee joint angle are trained and analyzed in combination with a multi-layer perceptron (MLP), thereby achieving accurate knee joint function assessment.

[0097] An embodiment of the present invention provides a mapping system of muscle deformation signals and exoskeleton joint angles, including a sensor module, a Transformer model, an exoskeleton device, a control module, a communication module, a motor drive module and a harmonic reducer.

[0098] The sensor module includes five distributed strain sensors arranged on the knee pad body. The sensor includes a stretchable base layer and a stretchable conductor unit. The stretchable base layer is laid on the knee pad body. The stretchable conductor unit is used to produce electrical performance changes following the deformation of the stretchable base layer.

[0099] Figure 3 This is a flexible sensor for measuring human muscle deformation in an embodiment of the present invention.

[0100] like Figure 3 As shown, the sensor in this embodiment is a flexible sensor of a wearable kneepad. By arranging a distributed strain sensor on the kneepad body, when the kneepad is deformed, the stretchable conductor unit can be driven to deform, thereby producing a change in electrical performance, and the deformation of the kneepad is mapped through the change in electrical performance. It has high accuracy and is not easily affected by external interference.

[0101] The wearable knee brace sensor collects five muscle deformation variables around the knee joint and is also the input part of this system. When the knee begins to bend, it stretches or compresses the five sensors on the knee brace, and these sensors detect this deformation and return an analog value.

[0102] In summary, the distributed strain sensors on the knee brace can acquire data in real time by monitoring the deformation variables of five muscle areas around the knee joint. The working mechanism of these sensors is as follows: when the knee begins to bend or undergo other forms of movement, the five sensors on the knee brace will be stretched or compressed to varying degrees. These sensors convert this deformation into electrical signals and return analog data. This data can be used to analyze the movement pattern of the knee joint.

[0103] The data processing flow of the Transformer model is as follows: first, the data is encoded and the encoded data is transmitted to the encoder. In the encoder, the data features are calculated through a multi-head self-attention mechanism. After the feature calculation is completed, it is combined with the knee joint angle information and trained and analyzed using a multi-layer perceptron neural network.

[0104] Figure 2 This is a flowchart of the algorithm of multi-head attention in an embodiment of the present invention.

[0105] like Figure 2 As shown in the figure, the algorithm flow is: data dimensionality increase (data encoding) → multi-head self-attention calculation → layer normalization and residual connection → data dimensionality reduction → data fusion → multi-layer perceptron.

[0106] The encoder of the Transformer model consists of multiple stacked encoder layers. Each encoder layer includes a multi-head self-attention mechanism (MSM), layer normalization (LN) and residual connection (RC) operations. Each attention head of the multi-head self-attention mechanism calculates different attention weights, so as to capture the correlation between different parts of the input data.

[0107] Exoskeleton devices are used to assist human joint movements. The weight of the lower limb exoskeleton needs to be borne more or less by the human body, and the structural design needs to have the properties of small size and light weight. At the same time, the design of the exoskeleton should try to avoid interference or collision of the mechanical structure with the lower limbs of the human body and the surrounding environment.

[0108] Figure 4 4 is a control flow chart of the exoskeleton device in an embodiment of the present invention.

[0109] like Figure 4 As shown, according to the number of joints involved in the movement of the lower body and legs of the human body, the exoskeleton device in this embodiment includes an ultra-flat joint actuator composed of 4 DC brushless outer rotor disc motors, and the ultra-flat joint actuator is equipped with a Hall sensor and a harmonic reducer of matching size. Under the working condition of the rated output speed of 60 rpm, the ultra-flat joint actuator has an output torque of 23N·m and a maximum instantaneous output torque of 80N·m. It can continue to work for 5 seconds under overload conditions, reserving sufficient power-off time for sudden accidents. The joint actuator is powered by a 24V DC voltage and can be powered by a common switching power supply and a lithium battery. The weight of a single joint actuator is 940g.

[0110] Furthermore, the ultra-flat joint actuators correspond to the positions of each major joint. In the lower limbs, two ultra-flat joint actuators are arranged at each hip joint, and one ultra-flat joint actuator is arranged at each knee joint. Therefore, a single lower limb exoskeleton has 4 degrees of freedom. The degrees of freedom include the rotation of the thigh bone, the bending and straightening of the knee.

[0111] The motor drive module is the key link in controlling the operation of the ultra-flat joint actuator (motor), and the ultra-flat joint actuator (motor) is one of the core components of the exoskeleton device.

[0112] The upper computer of the control module adopts PC, and the lower computer adopts STM32F103VET6 microcontroller.

[0113] The communication module uses CAN Open communication and serial port communication.

[0114] Figure 5 4 is a control flow chart in an embodiment of the present invention.

[0115] like Figure 5 As shown, the control process of the embodiment of the present invention is:

[0116] After the sensor module collects the muscle deformation signal, it sends the data to the PC through the serial port, inputs the data into the Transformer model, and after the angle is solved, the PC sends the data to the single-chip microcomputer STM32F103VET6 through the serial port, and the single-chip microcomputer sends the data to the motor drive module through CAN Open communication, so that the motor drive module controls the harmonic reducer for transmission. In this embodiment, the knee rotation angle is made consistent with the hip joint rotation angle. The motor at the hip joint rotates the corresponding angle when the motor at the knee rotates.

[0117] Embodiment 2:

[0118] The embodiment of the present invention applies the mapping system of muscle deformation signals and exoskeleton joint angles in the above-mentioned embodiment 1, and utilizes the transformer's multi-head self-attention algorithm, which is a technology widely used in the fields of natural language processing and machine learning. The vectors at each position in the input sequence are subjected to three linear transformations respectively to generate a query matrix Q, a key matrix K, and a value matrix V, and multi-head attention calculations are performed to extract data-related features. The process of the method is to extract five muscle deformation variables around the knee brace and map them with the angle of the human knee joint, thereby achieving accurate prediction of the knee joint angle.

[0119] The embodiment of the present invention provides a method for mapping muscle deformation signals to exoskeleton joint angles, comprising the following steps:

[0120] S1, extract feature data of the input muscle deformation signal to obtain key feature vectors.

[0121] The device for collecting data on muscle changes around the knee is a wearable smart kneepad. A distributed strain sensor is set on the kneepad, so that when the kneepad is deformed, the stretchable conductor unit can be deformed to produce changes in electrical properties, and the deformation of the kneepad is mapped through changes in electrical properties. The kneepad is integrated with a data processing unit that can collect and process sensor data in real time and transmit data to external devices through a wireless module. The data format sent back by the kneepad is {a1, a2, a3, a4, a5}. Among them, a1~a5 are data contents, which are integer data.

[0122] In order to process these one-dimensional data, we need to reshape the data into a two-dimensional space. Therefore, we need to encode the data in order to increase the dimension of the data and map it to the two-dimensional space using a trainable linear projection. First, transpose the data "{a1,a2,a3,a4,a5}". It becomes (a1,a2,a3,a4,a5) T A matrix with five rows and one column. Then multiply this matrix by a matrix of trainable coefficients with one row and n columns. The formula is as follows:

[0123]

[0124] From the above formula, we can see that in matrix A, each row of elements can be abstractly expressed as its original data through a coefficient matrix. For example, the first row of data in matrix A (a 11 …a 1n ) linearly expresses a1 through a coefficient matrix w, (a 21 …a 2n ) linearly expresses a2 through a coefficient matrix w, (a 31 …a 3n ) linearly expresses a3 through a coefficient matrix w, (a 41 …a 4n ) linearly expresses a4 through a coefficient matrix w, (a 51 …a 5n ) linearly expresses a5 through a coefficient matrix w.

[0125] This is actually equivalent to encoding the original data. The purpose of encoding the original data is to map the one-dimensional data into a multi-dimensional space so that it can be processed using a more complex model while capturing more features and information.

[0126] By converting the original one-dimensional vector into a two-dimensional matrix, we enhance the expressiveness of the data. The linear transformation (dot multiplication operation) allows each original data element to be mapped to a new space through the weight matrix. In this encoding mechanism, w (weight matrix) is a trainable parameter, which means that during the training process, through the back-propagation algorithm, the value of w will be constantly adjusted so that the model can better fit the data. This allows the encoding process to dynamically adapt to the data. Through training, the parameters in the weight matrix will be adjusted to the optimal state, so that the encoded representation can be better used for downstream tasks. Trainable encoding parameters give the model greater flexibility and expressiveness when processing different data sets, thereby improving overall performance.

[0127] By upgrading the one-dimensional vector to a multi-dimensional matrix, the feature representation capability is enhanced, so that each original data can be more richly expressed through the coefficient matrix. This dimensionality increase operation makes the data suitable for the input requirements of sequence-to-sequence models such as Transformer, because these models generally process multi-dimensional feature matrices rather than simple one-dimensional vectors. This conversion ensures that the data can be processed more efficiently by the model.

[0128] Through linear mapping, each original data can be mapped to a multidimensional space through a coefficient matrix, thereby capturing more information and features and improving the performance of the model.

[0129] In short, the above operation is equivalent to encoding the original data once, mapping the one-dimensional vector data into a high-dimensional matrix through transposition and linear transformation operations. This encoding method not only enhances the expressiveness of the data, but also helps to adapt to the input requirements of the model. At the same time, through trainable parameters, the encoding process dynamically adapts to the data, thereby improving the overall performance of the model.

[0130] S2, uses a multi-head attention layer to process the key feature vector to obtain the feature representation of the focused part.

[0131] Self-Attention is one of the core mechanisms of the Transformer model, which enables the model to dynamically focus on different parts of the sequence when processing the input sequence. The self-attention mechanism allows each position in the sequence to pay attention to all other positions in the sequence through a weighted sum. This mechanism is implemented through three matrices (query matrix Q, key matrix K, value matrix V).

[0132] The input is a matrix containing the sequence, usually represented as (X) (shape is ((n,d)), where (n) is the sequence length and (d) is the feature dimension). The input is transformed through three different linear transformations to obtain the query matrix (Q), key matrix (K) and value matrix (V). Then, the attention mechanism can be expressed by a simple formula:

[0133]

[0134] Among them, Q (Query), K (Key), V (Value) are input vectors. This formula means that we perform a linear transformation on K and V, then calculate the dot product of Q and K, obtain the attention weight after softmax normalization, and then multiply it with V to get the final output.

[0135] The multi-head self-attention mechanism is an extension of the attention mechanism. It divides the input into multiple "heads" and allows the model to independently calculate attention in different subspaces, which can capture more levels of features.

[0136] Specifically, the multi-head self-attention mechanism includes the following steps:

[0137] The input vectors Q (Query), K (Key), and V (Value) are linearly transformed into multiple heads respectively, and the dimension of each head is reduced, usually d / h, where d is the dimension of the input vector and h is the number of heads.

[0138] Step 1. Each head calculates the attention mechanism independently.

[0139] Step 2: Concatenate the outputs of all heads and perform linear transformation to obtain the final output.

[0140] The formula is:

[0141] MultiHead(Q,K,V)=Concat(head1,head2,...,head n )W o (3)

[0142] The calculation process of each head is:

[0143] head i =Attention(Q i , K i , V i )#(4)

[0144] Perform multi-head self-attention calculation on the upgraded data, and multiply the upgraded matrix A by three different linear transformation matrices W Q , W K , W V , thus obtaining three matrices Q, K, and V, the formula is as follows:

[0145]

[0146] Among them, the three matrices Q, K, and V are 5-row and m-column matrices, and the value of m should be an integer multiple of the number of heads;

[0147] Then split the three matrices Q, K, and V. The number of matrices after splitting is the corresponding number of heads. Split the matrix into h heads, and the number of columns of each matrix should be The corresponding formula is as follows:

[0148]

[0149] As shown above, the three matrices Q, K, and V are split into h heads to obtain Q1, ...Q h , K1, ... K h , V1, ... V h , these matrices are respectively calculated by self-attention weight to obtain the matrix Z. According to the self-attention calculation formula, first Q1, ...Q h , K1, ... K h Multiply them separately, the formula is as follows:

[0150]

[0151] The obtained matrix is ​​subjected to softmax transformation, and we have:

[0152]

[0153] Among them, we perform softmax normalization on the row elements of the matrix so that the sum of each row element is 1, and we have

[0154]

[0155] Then multiply the softmax transformed matrix by V, and we have:

[0156]

[0157] in,

[0158] In multi-head attention calculation, the Q of each head i , K i , V i All need to perform self-attention calculations to obtain the matrix Z i , and finally the matrix Z of each head will be obtained i Splice them together to get the matrix Z and complete the multi-head self-attention calculation. The formula is as follows:

[0159]

[0160] S3, perform layer-by-layer normalization on the feature representation to obtain standardized feature data.

[0161] Layer normalization normalizes the feature dimensions of each input sample so that each feature dimension has the same distribution across different samples. This is different from batch normalization (BatchNorm), which normalizes each feature within a batch.

[0162] In neural network training, normalization refers to transforming the input data so that its distribution is more consistent with a certain standard or uniform distribution, which helps improve the training effect of the model.

[0163] Common normalization methods include batch normalization and layer normalization. Batch normalization is to normalize the data in each batch, while layer normalization is to normalize the data in each layer. Here we use layer normalization. It can help solve problems such as gradient explosion in deep neural networks, thereby accelerating the training process and improving the convergence speed of the model.

[0164] The layer normalization formula is as follows:

[0165]

[0166] Among them, E(x) is the mean of x, σ(x) is the standard deviation of x, ε is a very small number to prevent the denominator from being 0; γ and β are learnable parameters.

[0167] After the multi-head attention calculation is completed, we need to normalize each row of the matrix. The formula is as follows:

[0168]

[0169] in, for:

[0170]

[0171] According to the layer normalization formula, γ is 1, β is 0, and ε is (1e-6), which is 10 to the power of -6. 1e-6 is scientific notation, that is, 1 times 10 to the power of -6.

[0172] S4, using residual connection to add the feature representation and feature data to obtain the added feature data.

[0173] Residual connection is a special connection method that allows the network layer to add input data directly to output data, thus forming a "skip connection" structure. This structure makes it easier for the network to learn identity mapping during deep learning, thereby avoiding the gradient vanishing problem during deep network training.

[0174] The data calculated by the multi-head self-attention part is layer-normalized to prevent gradient explosion, and a residual connection is performed to prevent gradient disappearance.

[0175] We need to normalize the layers The matrix is ​​added to the A matrix after the initial dimension increase, but we will find that is a matrix with 1 row and m columns, and A is a matrix with 1 row and n columns. Therefore, in the present invention, we set n = m, so that the matrix after the output of the multi-head attention layer does not need to be multiplied by a W o The matrix is ​​transformed in dimension. The residual connection formula is as follows:

[0176]

[0177] S5, performing data dimensionality reduction on the added feature data to obtain dimensionality reduced data.

[0178] In the early data processing, all operations are based on dimensionality increase. After the encoder completes the data processing, the data needs to be reduced in dimension to restore it to its original dimension. Specifically, by applying a linear layer, the n-column and five-row data in the sample is converted into a row of data with five columns. This process involves applying a linear transformation to the high-dimensional data, thereby achieving compression and conversion of the data dimension, ensuring that the data returns to the expected form for subsequent processing and analysis.

[0179] We need to make The data is reduced to one row and five columns, and the formula is as follows:

[0180]

[0181] Then the C matrix is ​​the matrix after dimensionality reduction;

[0182] S6, enhance the features after dimensionality reduction to obtain increased data.

[0183] It is worth noting that although the data has been reduced in dimensionality, it is still not suitable for direct use at this stage because the encoder's job is only to extract feature representations of the data, not the original data itself. Therefore, a crucial step is to merge the features extracted by the encoder with the original data before dimensionality increase. This process involves combining the feature representation with the actual data to ensure that the final data contains the original information while retaining important features.

[0184] When the encoder processes data, it usually extracts a set of high-level features that can better represent the deep information of the data. However, these features are not the original data itself, but an abstraction and concentration of the original data. The feature extraction ability of the encoder can help identify potential patterns and relationships in the data, but it loses some of the original specific information.

[0185] To make up for this deficiency, we perform dimensionality reduction on the data output by the encoder and then add these dimensionality-reduced features to the original data. This process is called feature enhancement. The specific formula is as follows:

[0186] (a1,a2,a3,a4,a5)+(c1,c2,c3,c4,c5)=(α1,α2,α3,α4,α5) (21)

[0187] This operation will make each feature in each sample in the original data not only have its own original data, but also include the data of other features in the same sample. Then when doing linear regression, a feature needs to consider not only its own influence, but also the influence of other features. This can improve the training effect of the neural network and make the model easier to optimize and generalize.

[0188] Through feature enhancement, we can use both the specific information of the original data and the high-level features extracted by the encoder to improve the performance of the model. This method is widely used in many machine learning and deep learning tasks because it can retain the important information of the original data while using the deep features extracted by the encoder to improve the accuracy and robustness of the model.

[0189] S7, performing data mapping based on the added data to obtain a mapping result between the muscle deformation signal and the exoskeleton joint angle.

[0190] In the above process, there is only one decoder layer, but in actual operation, multiple encoder layers are set to form an encoder. In this step, we combine the encoder output with the knee angle and send it to the multi-layer perceptron (MLP) for training and analysis, so as to achieve accurate knee joint function assessment.

[0191] The activation function selects the leaky_relu function:

[0192]

[0193] If the input x is greater than 0, the output is x; if the input x is less than or equal to 0, the output is α times the input.

[0194] Compared to the ReLU activation function, this means that the dead ReLU problem can be solved because the gradient value is no longer limited to 0. In addition, this function can also avoid the gradient disappearance problem.

[0195] We let the knee angle be y, and form a neural network with the data output by the encoder. The formula is as follows:

[0196]

[0197] Embodiment 3:

[0198] To ensure efficient and accurate collection of the deformation data of the muscles around the knee, this embodiment provides an innovative collection method. First, collect the data of each frame sent back by the knee pad. The specific data format is "{a, b, c, d, e}", where "a, b, c, d, e" are the deformation data (integer data) of the five muscles around the knee. These data will change with the change of the knee angle. For example, the deformation data may be "{3140, 2850, 1910, 2320, 2560}".

[0199] In order to train the model, we need 750 data samples from the knee fully extended (0 degrees) to 90 degrees of bending. However, considering that the data feedback from the sensor is different each time the smart knee brace is worn, collecting data at each angle is not only time-consuming and laborious, but also the data may be inconsistent under different wearing conditions. Therefore, only the deformation data of the knee at two key angles of 0 degrees and 90 degrees are collected.

[0200] By evenly dividing the deformation data of 0 degrees and 90 degrees into 750 parts, and dividing the corresponding angles into 750 parts, we can efficiently generate training samples. This method not only simplifies the data collection process, but also enables online data collection and training after each wear, ensuring the accuracy and adaptability of the model in different situations. Among them, 50 parts are selected as the validation set.

[0201] The entire model is built in the pytorch environment. After obtaining the knee pad data through the serial port, it is parsed into training samples and transmitted to the model for training. Here we need to use regression mode instead of classification. If classification is used, the output of the angle can only be limited to one of the 750 angles, and the accuracy is very poor, so a regression model is needed. The loss function selects the mean absolute error. The optimizer selects the gradient descent (SGD) algorithm. Because the training is online collection and online training, the training time cannot be too long, so the number of training iterations is selected as 1000 times.

[0202] The main parameters we can adjust are: the dimension of the data when it is dimensional, the number of heads of multi-head self-attention, the learning rate step size, the momentum factor, and the number of encoder layers.

[0203] Dimensions when data is upgraded: In order to make full use of the feature data after dimensionality reduction, we need to upgrade it to a suitable dimension so that it can be input into each layer of the model. The choice of dimension for dimensionality upgrade will affect the performance of the model, so multiple experiments and adjustments are required.

[0204] The number of heads of multi-head self-attention: In the model, the multi-head self-attention mechanism can capture the correlation between different parts of the data. Adjusting the number of attention heads can affect the depth and accuracy of the model's understanding of the data.

[0205] Learning rate step size: The learning rate step size determines the adjustment amplitude of the model parameters at each update. A suitable learning rate step size can accelerate the convergence process of the model and avoid overfitting or underfitting.

[0206] The number of encoder layers: The choice of the number of encoder layers directly affects the depth and complexity of the model. More layers can increase the expressiveness of the model, but may also lead to increased training time and increased risk of overfitting.

[0207] Momentum Factor: Momentum factor is used in the gradient descent algorithm to speed up convergence and avoid local minima. We try different momentum factors to find the best momentum factor value for the current dataset.

[0208] Evaluation indicators: During the neural network training process, the most basic requirement is that the loss function of the training set must converge and stabilize. When the loss of the training set is stable, the loss function of the validation set is usually slightly larger than the loss function of the training set, which indicates that the model has good generalization ability. When the loss of the validation set is the same, the smaller the loss of the training set, the better, which indicates that the model fits the training data better. When the loss of the training set is the same, we hope that the loss of the validation set is as small as possible, but we need to ensure that the loss of the validation set is slightly larger than the loss of the training set, indicating that the model has a certain generalization ability.

[0209] In order to select appropriate neural network training parameters, the present invention designs a specific experimental scheme. Using the control variable method, when one of the parameters is selected for the experiment, the other four parameters remain unchanged. Therefore, at least five groups of experiments are required to complete the parameter selection. Each group of experiments focuses on the selection of a specific parameter. In the experiment, the selection of each parameter requires 10 experiments, and the average of the 10 loss values ​​is selected as the loss value corresponding to this parameter selection.

[0210] Experiment 1 Learning rate selection: Among the above five parameters, the learning rate step size and momentum factor have the greatest impact on the training results, which can directly determine whether the training results converge. Therefore, based on experience, we start with a learning rate of 0.00001 and a momentum factor of 0.5 and gradually adjust them. First, conduct a learning rate selection experiment. The rest of the parameter settings are shown in Table 1. The maximum number of training iterations is 1000. The training results are shown in Table 1:

[0211] Table 1 Learning rate settings

[0212]

[0213] From the above table, we can see that the training results converged only when the learning rate was set to 0.0000001. From the experiment, we can see that either the step size is set too large and the minimum value cannot be found, resulting in too large fluctuations in the loss function and non-convergence, or it is set too small and when the number of training iterations reaches the maximum, the loss function still decreases and does not converge. Therefore, we choose 0.0000001 as the learning rate.

[0214] Experiment 2 Momentum factor selection: The larger the momentum factor, the faster the convergence speed, but if it is too large, it may cause the loss function to drop too quickly, skip the minimum value, and cause the loss function to fluctuate greatly and not converge. The smaller the momentum factor, the slower the convergence speed, but the update process is more stable and may fall into the local minimum. Therefore, it is necessary to find a balance between the two to ensure that the model can stably converge to the global optimal solution. The training results are shown in Table 2:

[0215] Table 2 Momentum factor settings

[0216]

[0217] From the above table, we can see that the most appropriate momentum factor is 0.85. If it is too small, the loss function will drop too slowly and lack sufficient momentum to jump out of the local minimum, which will affect the model's ability to find the global optimal solution. If it is too large, the update amplitude will become too aggressive, causing the loss function to drop too quickly and skip the global minimum, resulting in large fluctuations in the loss function during training and difficulty in converging to a stable minimum.

[0218] Selection of data dimension in Experiment 3: Data dimension is the dimension of the original data when it is upgraded, or it can be understood as the dimension after data encoding. Too large or too small will affect model performance. The training results are shown in Table 3:

[0219] Table 3 Data dimension settings

[0220]

[0221] From the above table, we can see that according to the experimental samples of the present invention, if the dimension of the data is too small, the gradient of the loss function will explode, and if it is smaller, the loss function will be larger. If it is too large, the loss value will not only fail to converge, but also overfitting will occur, so the data dimension of 10 is the most appropriate.

[0222] Experiment 4: Selection of the number of self-attention heads:

[0223] In the Transformer model, the number of self-attention heads directly affects the model's representation ability, computational efficiency, and ability to capture contextual information. Appropriately increasing the number of heads can improve model performance, but it is necessary to balance computing resources, memory requirements, and overfitting risks. The choice of the number of heads needs to be optimized based on specific tasks, data volume, and hardware resources. A model that is too small will have poor performance, and a model that is too large will have overfitting. The training results are shown in Table 4:

[0224] Table 4 Data dimension settings

[0225]

[0226] From the above table, we can see that 5 self-attention heads are the most appropriate. If the number is too large, overfitting will occur, and if the number is too small, the loss function will be slightly larger.

[0227] Experiment 5 Selection of encoder layers:

[0228] In the Transformer model, the number of encoder layers has an important impact on the performance and behavior of the model. The following is a detailed analysis of the main impact of the number of encoder layers: Increasing the number of encoder layers can increase the depth of the model, enabling it to learn more complex and abstract representations and capture deeper features and patterns. Deeper encoder layers can gradually improve the level of abstraction of features through layer-by-layer feature conversion and combination, so that the model has a stronger understanding of complex input data. Increasing the number of encoder layers also brings a higher risk of overfitting, especially when there is insufficient training data or the data quality is not high, the model may overfit the training data, resulting in a decrease in generalization ability. The training results are shown in Table 5:

[0229] Table 5 Encoder layer settings

[0230]

[0231] From the above table, we can see that 6 is the most appropriate number of encoder layers. If it is too large, overfitting will occur, and it will occupy more hardware resources and take longer training time. If it is too small, the loss function will be slightly larger.

[0232] From the above five sets of experiments, it can be seen that in the architecture of the present invention, the selection of parameters for the learning rate, momentum factor, number of self-attention heads, encoder layer, and data dimension is shown in Table 6:

[0233] Table 6 Final parameter selection

[0234]

[0235] At this point, the entire system construction and the selection of system internal parameters have been completed. Next, this system can be used to collect knee pad data, convert it into knee joint / motor control angles in real time, and send it to the exoskeleton control unit.

[0236] Figure 6 is a physical diagram of a mapping system between muscle deformation signals and exoskeleton joint angles in an embodiment of the present invention, Figure 7 It is an overall driving flow chart in an embodiment of the present invention.

[0237] like Figure 6 , 7As shown, an embodiment of the present invention provides a mapping system of muscle deformation signals and exoskeleton joint angles, which uses a separate sensor device to drive the exoskeleton motor to achieve accurate perception of the lower limb joint angles. The powered exoskeleton can make corresponding movements with the human body under the constructed collaborative motion framework without time delay. A method based on a transformer model is proposed. The invention collects signals from muscles around the knee joint and uses the Transformer algorithm to process and analyze the signals. It can effectively convert the extracted muscle signals into the knee joint angle signals required for exoskeleton control, and adjust the exoskeleton's motion mode in real time, thereby achieving precise control of human-machine collaboration.

[0238] Those skilled in the art know that, in addition to realizing the system and its various devices, modules, and units provided by the present invention in a purely computer-readable program code, it is entirely possible to realize the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices, modules, and units provided by the present invention can be considered as a hardware component, and the devices, modules, and units included therein for realizing various functions can also be regarded as structures within the hardware component; the devices, modules, and units for realizing various functions can also be regarded as both software modules for realizing the method and structures within the hardware component.

[0239] In the description of the present application, it should be understood that the terms "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.

[0240] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A mapping system of muscle deformation signals and exoskeleton joint angles, characterized in that: include: Sensor module, Transformer model, exoskeleton device, control module, communication module, motor drive module and harmonic reducer; The sensor module is used to collect muscle deformation signals; The Transformer model is used to perform feature processing on the received muscle deformation signal using a multi-head attention mechanism, and then train and analyze the processed features and knee joint angles in combination with a multi-layer perceptron; The exoskeleton device is used to assist human joint movements; After the sensor module collects the muscle deformation signal, it is sent to the control module through the communication module, and then input into the Transformer model to obtain an output result. The control module then sends the output result to the motor drive module through the communication module, and the motor drive module controls the harmonic reducer to drive the exoskeleton device to move.

2. The mapping system of muscle deformation signal and exoskeleton joint angle according to claim 1, characterized in that: The sensor module includes five distributed strain sensors arranged on the knee pad body, and the sensor includes a stretchable base layer and a stretchable conductor unit. The stretchable base layer is laid on the knee pad body, and the stretchable conductor unit is used to produce electrical performance changes following the deformation of the stretchable base layer.

3. The mapping system of muscle deformation signal and exoskeleton joint angle according to claim 1, characterized in that: The data processing flow of the Transformer model is as follows: first, the data is encoded and processed, and the encoded data after dimension increase is transmitted to the encoder. In the encoder, the data features are calculated through a multi-head self-attention mechanism. After the feature calculation is completed, it is combined with the knee joint angle information and trained and analyzed using a multi-layer perceptron neural network; The algorithm process includes data dimensionality increase, multi-head self-attention calculation, layer normalization and residual connection, data dimensionality reduction, data fusion and multi-layer perceptron; The encoder includes multiple stacked encoder layers, each encoder layer includes a multi-head self-attention mechanism, layer normalization and residual connection operations, wherein each attention head of the multi-head self-attention mechanism calculates different attention weights respectively, so as to capture the correlation between different parts of the input data.

4. The mapping system of muscle deformation signal and exoskeleton joint angle according to claim 1, characterized in that: The exoskeleton device includes an ultra-flat joint actuator composed of four DC brushless outer rotor disc motors, the ultra-flat joint actuator is equipped with a Hall sensor and a harmonic reducer with matching size, and the ultra-flat joint actuator is powered by a 24V DC voltage; The ultra-flat joint actuators correspond one-to-one to the positions of the main joints. In the lower limb part, two ultra-flat joint actuators are arranged at the left and right hip joints, and one ultra-flat joint actuator is arranged at the left and right knee joints.

5. The mapping system of muscle deformation signal and exoskeleton joint angle according to claim 1, characterized in that: The upper computer of the control module adopts PC, the lower computer adopts single-chip microcomputer STM32F103VET6, and the communication module adopts CANOpen communication and serial port communication; the control process of the control module is: after the sensor module collects the muscle deformation signal, the data is sent to the PC through the serial port, the data is input into the Transformer model, and after the angle is solved, the PC sends the data to the single-chip microcomputer STM32F103VET6 through the serial port, and the single-chip microcomputer sends the data to the motor drive module through CAN Open communication, so that the motor drive module controls the harmonic reducer for transmission.

6. A method for mapping muscle deformation signals to exoskeleton joint angles, using the mapping system for muscle deformation signals to exoskeleton joint angles as claimed in any one of claims 1 to 5, characterized in that: The steps include: S1, extracting feature data from the input muscle deformation signal to obtain key feature vectors; S2, using a multi-head attention layer to process the key feature vector to obtain a feature representation of the focused part; S3, performing layer normalization on the feature representation to obtain normalized feature data; S4, adding the feature representation and the feature data using a residual connection to obtain added feature data; S5, performing data dimensionality reduction on the added feature data to obtain dimensionality-reduced data; S6, enhancing the features after dimensionality reduction to obtain increased data; S7, performing data mapping based on the added data to obtain a mapping result of the muscle deformation signal and the exoskeleton joint angle.

7. The method for coordinated movement of lower limb exoskeleton joint angles according to claim 6, characterized in that: In step S1, the input muscle deformation signal is {a1, a2, a3, a4, a5}, where a1 to a5 are data contents, which are integer data; Transpose the data {a1,a2,a3,a4,a5} to (a1,a2,a3,a4,a5) T A matrix with five rows and one column, and then multiply the matrix by a matrix of trainable coefficients with one row and n columns (w1,w2,w3,…,w n ), we get the matrix A, the formula is as follows: In matrix A, each row element abstractly expresses its original data through a coefficient matrix.

8. The method for coordinated movement of lower limb exoskeleton joint angles according to claim 6, characterized in that: In step S2, the self-attention mechanism is implemented through three matrices (query matrix Q, key matrix K, value matrix V); the input is a matrix containing sequences, usually represented as (X) (shape is ((n, d)), where (n) is the sequence length and (d) is the feature dimension), and the input is transformed through three different linear transformations to obtain the query matrix (Q), key matrix (K) and value matrix (V). The expression formula of the attention mechanism is: Among them, Q (Query), K (Key), V (Value) are input vectors. The formula represents linear transformation of K and V, then calculating the dot product of Q and K, obtaining the attention weight after softmax normalization, and then multiplying it with V to obtain the final output; The multi-head self-attention mechanism is an extension of the self-attention mechanism. The input vectors Q (Query), K (Key), and V (Value) are linearly transformed into multiple heads respectively. The dimension of each head is reduced, usually d / h, where d is the dimension of the input vector and h is the number of heads. The process of the multi-head self-attention mechanism includes the following steps: Step 1: Each head calculates the attention mechanism independently; Step 2: Concatenate the outputs of all heads and perform linear transformation to obtain the final output; The formula is: MultiHead(Q,K,V)=Concat(head1,head2,…,head n )W O (3) The calculation process of each head is: head i =Attention(Q i ,K i ,V i ) (4) Perform multi-head self-attention calculation on the upgraded data, and multiply the upgraded matrix A by three different linear transformation matrices W Q ,W K ,W V , thus obtaining three matrices Q, K, and V, the formula is as follows: Among them, the three matrices Q, K, and V are 5-row and m-column matrices, and the value of m should be an integer multiple of the number of heads; Then split the three matrices Q, K, and V. The number of matrices after splitting is the corresponding number of heads. Split the matrix into h heads, and the number of columns of each matrix should be The corresponding formula is as follows: As shown above, the three matrices Q, K, and V are split into h heads to obtain Q1, ...Q h ,K1,…K h ,V1,…V h , these matrices are respectively calculated by self-attention weight to obtain the matrix Z. According to the self-attention calculation formula, first Q1,…Q h ,K1,…K h Multiply them separately, the formula is as follows: The obtained matrix is ​​subjected to softmax transformation, and we have: Among them, we perform softmax normalization on the row elements of the matrix so that the sum of each row element is 1, and we have Let's talk about the matrix dot multiplication V after softmax transformation, we have: in, In multi-head attention calculation, the Q of each head i , K i , V i All need to perform self-attention calculations to obtain the matrix Z i , and finally the matrix Z of each head will be obtained i Splice them together to get the matrix Z and complete the multi-head self-attention calculation. The formula is as follows:

9. The method for coordinated movement of lower limb exoskeleton joint angles according to claim 6, characterized in that: In step S3, the layer normalization formula is as follows: Among them, E(x) is the mean value of x, σ(x) is the standard deviation of x, ε is a very small number to prevent the denominator from being 0; γ and β are learnable parameters; After the multi-head attention calculation is completed, we need to normalize each row of the matrix. The formula is as follows: in, for: According to the layer normalization formula, γ is 1, β is 0, and ε is (1e-6), which is 10 to the power of -6. (1e-6) is scientific notation, that is, 1 times 10 to the power of -6.

10. The method for coordinated movement of lower limb exoskeleton joint angles according to claim 6, characterized in that: In step S4, the layer normalized The matrix is ​​added to the initial dimension-upgraded A matrix. is a matrix with 1 row and m columns, A is a matrix with 1 row and n columns, let n = m, the matrix after the output of the multi-head attention layer does not need to be multiplied by W o The matrix undergoes dimension transformation, and the residual connection formula is as follows: In step S5, The data is reduced to one row and five columns, and the formula is as follows: Then the C matrix is ​​the matrix after dimensionality reduction; Step S6, after the data output by the encoder is processed by dimensionality reduction, the features after dimensionality reduction are added to the original data, i.e., feature enhancement, the formula is as follows: (a1,a2,a3,a4,a6)+(c1,c2,c3,c4,c5)=(α1,α2,α3,α4,α5) (21) Step S7, combining the result output by the encoder with the knee angle and transmitting it to a multi-layer perceptron for training and analysis to achieve knee joint function assessment; The activation function selects the leaky_relu function: If the input x is greater than 0, the output is x; if the input x is less than or equal to 0, the output is α times the input; Let the knee angle be y, and form a neural network with the data output by the encoder. The formula is as follows:

Citation Information

Patent Citations

  • Control method suitable for variable-stiffness knee joint rehabilitation exoskeleton

    CN116270150A

  • Upper limb function reconstruction system for stroke patient

    CN116983185A

  • Disturbance estimation method for lower limb exoskeleton

    CN117493847A

  • Object image re-identification method based on multi-feature information capture and correlation analysis

    WO2023273290A1

Cited By

  • Exoskeleton mountaineering intention recognition method and system and storage medium

    CN121043103A

  • Exoskeleton mountaineering intention recognition method and system and storage medium

    CN121043103B