EMG_Biometrics_2021/README.md

48 lines
3.3 KiB
Markdown
Raw Normal View History

# Analysis of Keystroke EMG data for identification
2021-07-08 15:47:41 +00:00
#### EMG data handling and Neural Network analysis
Scripts to handle CSV files composed by 2 * 8 EMG sensors(left & right) devided into sessions per subject. The raw data is organised in a CSV_handler object with Handle_emg_data.py. Processing of data can take the further form of:
* Preprocessing with Signal_prep.py - FFT, MFCC, Wavelet db4
* Storage for Neural Network analysis with NN_handler(Handle_emg_data.py) - combined EMG DataFrame, combined MFCCs DataFrame
* Neural Network analysis in Neural_Network_Analysis.py - LSTM NN, etc.
#### Technologies used
* Common libs: Numpy, Pandas, Pathlib, Sklearn, Scipy, Matplotlib, Tensorflow, Keras
2022-08-11 14:58:30 +00:00
* Community libs: Python_speech_features, PyWavelets
2021-07-08 15:47:41 +00:00
#### Challanges in the module
* The CSV handlig requires a specific data file structure. Se "How to use it"
2021-07-08 15:47:41 +00:00
* Preprocessing is still limited in Signal_prep.py
* NB: `get_samplerate()` is configured for a sampling bug. See comment above function in Handle_emg_data.py
2021-07-08 15:47:41 +00:00
#### Credits for insporational code
* Kapre: Keunwoochoi
2021-07-08 15:47:41 +00:00
* Audio-Classification: seth814
* DeepLearningForAudioWithPyhton: musikalkemist
2022-08-11 14:59:34 +00:00
* PyWavelets reference: Gregory R. Lee, Ralf Gommers, Filip Wasilewski, Kai Wohlfahrt, Aaron OLeary (2019). PyWavelets: A Python package for wavelet analysis. Journal of Open Source Software, 4(36), 1237, https://doi.org/10.21105/joss.01237.
2021-07-08 15:47:41 +00:00
## Table of Contents
2021-07-08 16:08:46 +00:00
| File and classes | Description and help functions |
|---|---|
| Handle_emg_data.py:<br><br> * Data_container<br> * CSV_handler<br> * NN_handler | Handles, manipulates, and stores data for analysis. <br><br> * Data_container is a class that describes the data for each subject in the experiment.<br> * CSV_handler takes data from CSV files and places it in Data_container for each subject.<br> Use load_data() to load csv data into data containers and add the containers to the <br> CSV_handler's 'data_container_dict', indexed by subject number. Use get_data() to retrieve <br> specific data. <br> * NN_handler prepares data for further analysis in Neural Networks. This class has storage <br> for this data and/or can save it to a json file. |
| Signal_prep.py | Does mapping to data and contains various functions. Among others, this contains wavelet, <br>MFCC, cepstrum and normalization. |
| Present_data.py | Contains plot and case functions. Case functions combines many elements from the code and <br>presents some results described. |
| Neural_Network_Analysis.py | Contains functions to load, build and execute analysis with Neural Networks. Main functions are <br>load_data_from_json(), build_model(), and main() |
## How to use it
2021-07-08 16:08:46 +00:00
1. Clone the repo
2. Place the data files in the working directory
3. Place the data files within the `data`-folder as data is shown originally
(format: `/data/<datatype>/<subject-folder+ID>/<session-folder>/<left/right-CSV-files>`)
4. Assuming NN analysis:
1. Create a `CSV_handler` object
2. Load data with `load_data(CSV_handler, <datatype>, <filename_type>)`
3. Create `NN_handler` object with `CSV_handler` as input
4. Load MFCC data into the `NN_handler` with `store_mfcc_samples()`
5. Run `save_json_mfcc()` to save samples in json
6. Run `Neural_Network_Analysis.py` with desired config