Signal Classification
The raw EMG signals were processed in 500 ms segments, or extraction windows. Four features were calculated for each muscle channel: mean absolute value (MAV), number of zero crossings, number of slope sign changes, and waveform length. These features were concatenated into a 1x20 feature vector for each extraction window.
The classifier training data was comprised of 50 feature vectors for each movement and 20 feature vectors for the resting state. Based on this data, six 2-class linear discriminant analysis (LDA) classifiers (one for each movement) were built with the classify function in Matlab. The function outputs include a 20x1 vector corresponding to the coefficients of the classifier hyperplane, or decision boundary. The dot product of an incoming feature vector and this hyperplane coefficient vector results in a "score" that can be used to determine how likely the feature vector falls into a certain movement category.
For added accuracy, classifier score thresholds were set at the 1% false negative mark. Thus, a feature vector would only be classified as a certain movement if there is at least a 99% likelihood. In order to minimize accidental actuation of the robot, we check to make sure that this threshold is above the 0.1% false positive mark.
The five chosen movements were found to be linearly separable. Using recorded data, a 100-fold cross validation test with a 3:2 training to testing ratio yielded an average false positive error of 0% and an average false negative error of 2.08%, indicating a very robust classifier.
For added accuracy, classifier score thresholds were set at the 1% false negative mark. Thus, a feature vector would only be classified as a certain movement if there is at least a 99% likelihood. In order to minimize accidental actuation of the robot, we check to make sure that this threshold is above the 0.1% false positive mark.
The five chosen movements were found to be linearly separable. Using recorded data, a 100-fold cross validation test with a 3:2 training to testing ratio yielded an average false positive error of 0% and an average false negative error of 2.08%, indicating a very robust classifier.
Matlab Code:
|
|
The classifier code is divided into two parts, a script for building the classifier ('calibrationScriptAll.m') and a function to implement it in real-time ('practiceLDA_2cat.m').
In 'calibrationScriptAll.m', fifty 500ms segments of each movement are extracted from the training data. The code computes a feature vector for each segment, labels the segment (movement or non-movement), and builds a 2-category classifier based on this information. Then, the dot product of each feature vector and the coefficients is calculated to obtain scores for the movement and non-movement groups. This data is fitted to normal distributions, which is used to calculate and set the threshold. This is repeated for all 5 movements and the resting state. Finally, the hyperplane coefficients and threshold values for each classifier is saved into a classifier data file.
In 'practiceLDA_2cat.m', a 500ms window is processed to obtain a feature vector. The dot products of this feature vector and the hyperplane coefficients of each classifier (from a previously loaded classifier data file) is computed. This score is compared to the thresholds to determine which movement this window should be classified as. The function outputs the determined movement type.
In 'calibrationScriptAll.m', fifty 500ms segments of each movement are extracted from the training data. The code computes a feature vector for each segment, labels the segment (movement or non-movement), and builds a 2-category classifier based on this information. Then, the dot product of each feature vector and the coefficients is calculated to obtain scores for the movement and non-movement groups. This data is fitted to normal distributions, which is used to calculate and set the threshold. This is repeated for all 5 movements and the resting state. Finally, the hyperplane coefficients and threshold values for each classifier is saved into a classifier data file.
In 'practiceLDA_2cat.m', a 500ms window is processed to obtain a feature vector. The dot products of this feature vector and the hyperplane coefficients of each classifier (from a previously loaded classifier data file) is computed. This score is compared to the thresholds to determine which movement this window should be classified as. The function outputs the determined movement type.