This project focuses on developing and evaluating a classification algorithm capable of recognizing multiple hand gestures (at least four gestures plus rest) from multi-channel surface electromyography (sEMG) signals.
The goal is to design and compare various machine learning approaches, observing their robustness across different (e.g. 40) subjects and observing how the performance evolves by exploring an increasing number of hand gestures classes. The signal processing pipeline is kept fixed across all the analysis and consists of signal filtering (notch filter at 50Hz and bandpass Butterwoth 6th order filter between 5 - 500 Hz), followed by temporal features computation for each channel (and their concatenation in a single data representation). I decided to only consider features such as MAV, RMS, SSC, etc... which are associated to signal amplitude and temporal characteristics, since the sEMG dataset, containing a reduced number of channels, exploits more temporal informations rather than spatial ones.
Dataset: Multi-channel Surface Electromyography (sEMG) Signals of Hand Gestures
Source: Mendeley Data
Reference Paper:
*Ozdemir, Mehmet Akif; Kisa, Deniz Hande; Guren, Onan; Akan, Aydin (2021), “Dataset for multi-channel surface electromyography (sEMG) signals of hand gestures”, Mendeley Data, V2, doi: 10.17632/ckwc76xr2z.2
The dataset includes recordings of sEMG signals from 4 electrodes placed on the forearm during different hand gestures (10) for 40 healthy subjects with an equal gender distribution. he gestures in the data are rest or neutral state, extension of the wrist, flexion of the wrist, ulnar deviation of the wrist, radial deviation of the wrist, grip, abduction of all fingers, adduction of all fingers, supination, and pronation. The data were recorded with the BIOPAC MP36 device using Ag/AgCl surface bipolar electrodes. Each participant's data contains five repetitive cycles of ten hand gestures. A demographic survey was applied to the participants before the signal recording process.
-
Data Acquisition
- Download and explore the sEMG dataset.
- Inspect sampling rate, channel configuration, and gesture labels.
- Creating cached datasets for reproducibility.
-
Preprocessing
- Signal filtering (e.g., band-pass, notch).
- Normalization (optional) and Segmentation (using sliding-window of 200 ms width with 50% of overlapping).
-
Feature Extraction
- Time-domain features (RMS, MAV, WL, ZC, SSC, VAR) computed for each of the 4 channels.
- Concatenating the 6 features of each channel, obtaining a single 24 dimension vector.
-
Classification
- Train and evaluate models for gesture classification for each subject.
- Compare results across different classifiers (SVM with linear kernel, SVM with radial basis function kernel, LDA and RF).
- Averaging performances across subjects.
- Analysing performance on subject 1 using and increasing number of hand gestures.
-
Evaluation Metrics
- Accuracy and confusion matrix.
- 10 fold ross-validation evaluation.
- Statistical Analysis: Nemenyi non-parametric test for repeated measured on the same data split, using different classifiers.
emg_code/ ├── cached_dataloaders/ # Cached data and 10-fold indexes for reproducibility │ ├── patient1 # For each subject │ │ ├── cached_data │ │ ├── cached_fold_indexes │ │ ├── cached_data_nclasses_6 #only for patient1, cached data considering a variable number of hand gestures classes │ │ ├── cached_fold_indexes_nclasses_6 │ │ .... │ │ ├── cached_data_nclasses_10 │ │ └── cached_fold_indexes_nclasses_10 │ │ │ └── patient2 │ ├── cached_data │ └── cached_fold_indexes │ ... │ ├── classifiers/ # DL classifiers that initially I intended to use for analysis (not used) │ ├── sEMG_CNN.py │ │ ├── results/ # Results directory │ ├── figures # Directory containing the figures │ ├── LDA # LDA results (accuracies and cf) for each subject, across subject and for subject 1 using different numbers of classes │ ├── RF # RF results (accuracies and cf) for each subject, across subject and for subject 1 using different numbers of classes │ ├── SVM # Linear SVM results (accuracies and cf) for each subject, across subject and for subject 1 using different numbers of classes │ ├── SVM_rbf # Rbf SVM results (accuracies and cf) for each subject, across subject and for subject 1 using different numbers of classes │ └── statistical # Statistical analyses │ ├── training_utils/ │ ├── data_processing.py # Data management (loading from source, segmenting into different gestures and windowing) │ ├── features_computations.py # Feature Computation (on sliding windows or on single signal) │ ├── statistical_analysis.py # Code performing the statistical tests on the 10-fold accuracies for a single subject on the various classifiers │ └── save_load_functions.py # pickle functions to load and save results │ ├── classifier_comparison.py # Performance comparison across different ML classifiers (SVM, LDA, RF, ...) for a single subject on 5 hand gestures. Peforms statistical analyses and created plots. ├── classifier_comparison.ipynb # Notebook version of classifier_comparison.py for visualization. ├── EMG_Dataloader.py # Data organization and Dataset creation. ├── investigating_number_classes.py # Performs the same analyses of train_ml.py and classifier_comparison.py for Subject 1, using an increasing number of classes (from 6 to all 10 hand gestures). ├── multi_subject.py # Runs train_ml.py and classifier_comparison.py for all subjects. Also, performs across subjects average and analyses. └── README.md # Project documentation Clone the repository git clone https://github.com/rossicecilia/emg_code.git cd emg_code
Create and activate a virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
Cecilia Rossi 📧 cecilia.m.rossi@gmail.com
🔗 LinkedIn : https://www.linkedin.com/in/cecilia-rossi-2930b8291/ | GitHub: https://github.com/rossicecilia
This project is licensed under the MIT License.