Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Dataset #5

Open
O-Memis opened this issue Nov 2, 2023 · 5 comments
Open

The Dataset #5

O-Memis opened this issue Nov 2, 2023 · 5 comments
Assignees

Comments

@O-Memis
Copy link

O-Memis commented Nov 2, 2023

How we can get the dataset, the EMGLab website is not available now, it's not working.
Can you share the dataset also?

@maaghia
Copy link
Owner

maaghia commented Nov 2, 2023

Hi, I have uploaded all the signals from the VM muscle to my kaggle account (can be found here: https://www.kaggle.com/datasets/mariatoubal/emglab-vm) My partner has uploaded the signals from the BB muscle (can be found here: https://www.kaggle.com/datasets/lydialoubar/emglab) I still have the full dataset It contains some signals with nan values but I can provide a code to remove them. plz suggest a way of sharing if you need the whole dataset (couldn't upload on github, kaggle and drive)

@maaghia maaghia self-assigned this Nov 2, 2023
@O-Memis
Copy link
Author

O-Memis commented Nov 7, 2023

Hi , thank you very much for your share.
When I tried to explore the data, I saw that the signal values are extremely small and shows nothing like EMG, its kind a weird.
Infinitesimally small positive values, relatively much bigger negative values, nans. Non-nan values are weird.
It is a possibility that I have made a serious mistake, here below I wanted to show my code:

import matplotlib.pyplot as plt
import numpy as np
import os

folder_path = 'C:/Users/CASPER/Desktop/VM'

Initialize a list to hold each signal as a separate numpy array

data_list = []

Loop through each file in the folder

for filename in os.listdir(folder_path):
if filename.endswith('.bin'):
# Create the full file path
file_path = os.path.join(folder_path, filename)

    # Load the binary data from the file, reshape it to a 1D array and append it to the list
    data_list.append(np.fromfile(file_path, dtype=np.float64).reshape(-1, 1))

Stack all arrays vertically, so each signal has its own row

VMdataset1 = np.hstack(data_list).T

Print the shape of the result array for verification

print(VMdataset1.shape)

loop through each row (signal) of the data

for i in range(VMdataset1.shape[0]):
VMdataset1[i]= np.nan_to_num(VMdataset1[i],nan=0)

aaaa= VMdataset1[2,:]

plt.plot(aaaa)

@O-Memis O-Memis closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
@O-Memis O-Memis reopened this Nov 7, 2023
@maaghia
Copy link
Owner

maaghia commented Nov 7, 2023

This is the code I used to read the dataset, you can also try to look for the physionet dataset I left the link below

from IPython.display import display
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import os
import shutil
import posixpath
import wfdb

Demo 1 - Read a WFDB record using the 'rdrecord' function into a wfdb.Record object.

Plot the signals, and show the data.

record = wfdb.rdrecord('C:/Users/lenovo/OneDrive/Documents/working-on-N2001-EMG-labdataset/dataset/N2001A03BB/N2001A03BB51/N2001A03BB51') #here change the path to the one of the dataset on your pc
wfdb.plot_wfdb(record=record, title='N2001M01TF52')
display(record.dict)

Can also read the same files hosted on PhysioNet

#https://physionet.org/content/challenge-2015/1.0.0 in the /training/ database subdirectory.
record2 = wfdb.rdrecord('a103l', pn_dir='challenge-2015/training/')

@O-Memis
Copy link
Author

O-Memis commented Nov 9, 2023

Thank you for your return
" ModuleNotFoundError: No module named 'wfdb' " Actually I downloaded it from pip but it gives error in both Spyder and Jupyter notebook.
Also I need only EMG dataset, the ECG in physionet is not useful for me.

Additionally, this is an example of signals in the BB and VM datasets :

Figure 2023-11-10 011053

Are BIN files not compatible with numpy and only works with wfdb ? Can you share another version?

@O-Memis
Copy link
Author

O-Memis commented Jul 17, 2024

Okay I solved the WFDB issue. I imported, than used related part of your Kaggle code.
Downloading the library and the user guide can be reached by here: https://wfdb.readthedocs.io/en/latest/ And related articles & documents.

However, the acquisition of some of the EMG signals done by the authors are inaccurate and has high variance, in the dataset. This reduces the metric scores of my model. Paying attention to re-selection of data is important I guess.
I will be appreciating your suggestions, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants