I worked on activity recognition using muscle electrical activity and thigh motion. We explored the separation of walking, running, and cycling in a combined feature space, and developed temporal models that recognized the shape and order of movement within each cycle.
With Roshanak Houmanfar, Seyed Ali Etemad, and Mark Klibanov, I also studied an accelerometer-based approach using double cumulative-sum features and hidden Markov models.
Fusing muscle activity and motion
We combined thigh EMG with acceleration to recognize walking, running, and cycling. The two signals described complementary parts of the same action: EMG captured muscle activation, while acceleration captured movement. Mapping their features into a common space made the differences between activities visible.
Each plotted point is a feature vector computed from the combined EMG and acceleration signals. Its coordinates F₁, F₂, and F₃ locate that observation in the classifier’s numerical feature space. Colour and marker shape identify the known activity of a reference observation; a dark point identifies an observation from the selected test recording.
The views below show reference examples for the three activities together with a test recording. Cycling formed a compact group, walking occupied a second region, and running covered a broader range. We explored support vector machines and nearest-neighbour classification as compact ways to assign an activity label from these features.
| Activity | Marker | Vectors |
|---|---|---|
| Walking | Red circle | 18 |
| Running | Green triangle | 17 |
| Cycling | Blue square | 30 |
The 65 labelled vectors supply the class references. The numerical coordinates have different ranges: F₂ extends into the tens of thousands, while F₁ and F₃ occupy ranges in the hundreds. This makes feature scaling part of the classifier design, particularly when distances between vectors determine the label.
The running experiment was particularly useful. The participant ran back and forth across a room, slowing down to turn before accelerating again. Some test points moved toward the walking examples during these transitions. The trajectory through feature space therefore carried information about changes within the activity as well as its overall label.
For a linear decision function, a feature vector z is evaluated through g(z) = wᵀz + b. Its position relative to the decision surface determines the class decision. A nearest-neighbour method instead compares the new vector with labelled examples. Both approaches connect the geometry of the plotted clusters to a computation suitable for the embedded processor.
Recognition also controlled the next stage of analysis. The detected activity selected processing parameters for muscle segmentation, smoothing, and interpretation. This connected the classifier to the measurement system: a cycling contraction and a walking contraction could be processed using settings appropriate to their timing and shape.
Embedded feature extraction and classification
In an accelerometer-only implementation, we used a compact three-feature classifier with two linear decision stages. The input was a signed 16-bit acceleration value. A 19-sample moving average and detrending prepared the signal before feature extraction.
A 125-sample buffer supplied the maximum, mean, and minimum features. The decision stages applied their own shifts, scales, weights, and bias to those values. Writing z = [max, mean, min]ᵀ, each stage evaluates a weighted sum of individually shifted and scaled features:
| Condition | Label |
|---|---|
| g1 ≤ 0 | Cycling |
| g1 > 0 and g2 ≤ 0 | Running |
| g1 > 0 and g2 > 0 | Walking |
The instantaneous label entered a circular buffer of 150 decisions. Updating class counts as the oldest label left the buffer allowed a majority vote to stabilize the reported activity with a fixed amount of state. This connected the classifier’s decision geometry to a bounded-memory implementation.
Feature extraction, decision boundaries, and temporal voting each served a different purpose. The features summarized the acceleration waveform; the two decision surfaces assigned an activity; the vote controlled short-lived changes in the output. Their window lengths set the balance between responsiveness and stability.
Measuring repeated movement
The following experiment studied recognition from a single thigh-mounted accelerometer.
We collected three-axis acceleration at 125 Hz from eight participants, two women and six men, with a mean age of 25 years and a reported spread of ±4.5 years. Each person performed approximately 15 minutes of walking, running, and cycling over different speeds and intensities. Cycling included seated and standing conditions and different gear ratios.
The thigh placement made the recognizer useful within the same wearable that measured muscle activity. The accelerometer supplied the movement class and temporal context, while the EMG processing described contractions during that movement.
Representing the shape of a cycle
We first smoothed each acceleration axis and removed its local mean. Cumulative summation then formed a pseudo-velocity signal. Repeating the centering and cumulative-sum operations produced a pseudo-position feature that emphasized the shape of the movement cycle.
Centering before each summation controlled the accumulation of offsets. An approximately one-second local window gave the representation enough context to follow the activity while adapting to changes in the signal.
An adaptive threshold divided the pseudo-position signal into action segments. Within a sliding window, the threshold followed the local minimum plus a fraction of the local range.
We used a typical scale factor s between 2 and 4. As movement amplitude changed, the threshold changed with it, providing segments that represented comparable parts of successive cycles.
Learning the sequence of motion
Each activity had a five-state, left-to-right hidden Markov model. A state could persist or advance to the next state, allowing the model to describe the ordered phases of a movement and variation in their duration. A Gaussian observation model represented the features within each state.
Training used Baum–Welch iterations, with a maximum of 200 iterations. At run time, the forward algorithm evaluated a new segment under each activity model. The model with the greatest log-likelihood supplied the label, followed by a vote over the last three strides to stabilize the output.
The HMM approach represented the order of movement phases explicitly. The compact classifier described above summarized a signal window with three scalar features. These approaches let us study the balance between temporal representation and embedded computation.
Recognition results
We evaluated the HMM method using ten-fold cross-validation and a second experiment that held out an entire participant. The latter trained on seven people and tested on the eighth, repeating the procedure across the group.
| Performed ↓ Predicted → | Walking | Running | Cycling |
|---|---|---|---|
| Walking | 98% | 1% | 1% |
| Running | 7% | 92% | 1% |
| Cycling | 1% | 16% | 83% |
| Performed ↓ Predicted → | Walking | Running | Cycling |
|---|---|---|---|
| Walking | 98% | 0% | 2% |
| Running | 2% | 97% | 0% |
| Cycling | 1% | 15% | 84% |
Each row shows how a performed activity was classified. Percentages are rounded.
The class-level recognition rate for walking was 98% in both evaluations. Running reached 92% and 97%, while cycling reached 83% and 84%. The principal confusion was standing cycling being classified as running, reflecting the similarity of their thigh motion.
Including both cycling postures made that difficulty visible. The result showed why temporal structure was useful and why the activity conditions belonged in the interpretation of recognition accuracy. We took the method from MATLAB development to an embedded implementation that transmitted the detected activity to a phone in real time.