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

Reproducing the results of Graz data set A, 4 class motor imagery #24

Open
toncho11 opened this issue Jul 27, 2023 · 1 comment
Open

Comments

@toncho11
Copy link

toncho11 commented Jul 27, 2023

Thank you for sharing your code! It is rally nice to be able to reproduce results.
I have to admit that I am confused on how to prepare the dataset.
Once I am able to understand I might submit a PR explaining it in the README of this project.

  1. Is it possible to get all data using only the gdf files? I was trying to do that, but I realized that there is a problem with the labels for the test data. Here is my code for extracting data epochs (data windows) from the gdf. It works for the train data, but not for the test data.
        filename = self.root + 'A0%dT.gdf' % self.nSub
        print("Train subject data",filename)
        raw = mne.io.read_raw_gdf(filename)
        # Find the events time positions
        events, _ = mne.events_from_annotations(raw)
        # Pre-load the data
        raw.load_data()
        # Filter the raw signal with a band pass filter in 7-35 Hz
        raw.filter(7., 35., fir_design='firwin')
        # Remove the EOG channels and pick only desired EEG channels
        raw.info['bads'] += ['EOG-left', 'EOG-central', 'EOG-right']
        picks = mne.pick_types(raw.info, meg=False, eeg=True, eog=False, stim=False,
                       exclude='bads')
        # Extracts epochs of 3s time period from the datset into 288 events for all 4 classes
        #tmin, tmax = 1.0, 4.0
        tmin, tmax = 0, 4 - (1/250) #because fs = 250
        # left_hand = 769,right_hand = 770,foot = 771,tongue = 772
        event_id = dict({'769': 7,'770': 8,'771': 9,'772': 10})
        epochs = mne.Epochs(raw, events, event_id, tmin, tmax, proj=True, picks=picks,
                baseline=None, preload=True)
        train_data = epochs.get_data()
        train_labels = epochs.events[:,-1] - 7 + 1    

It seems that there is only one class in the test data 769 (left_hand).

  1. I also tried the mat files provided http://bnci-horizon-2020.eu/database/data-sets
    such as: http://bnci-horizon-2020.eu/database/data-sets/001-2014/A01T.mat
    But I do not see where the labels are?

  2. Now I am trying:

  1. I also verified that my code gives the right labels for A01T:
    My code from 1)
    4, 3, 2, 1, 1, 2, 3, 4, 2, 3, 1, 1, 1, 4, 2, 2, 1, 1, 3, 1, 2, 4,
    and when using your code with the true labels:
    4, 3, 2, 1, 1, 2, 3, 4, 2, 3, 1, 1, 1, 4, 2, 2, 1, 1, 3, 1, 2, 4,

Please comment on 1), 2), 3).

@eeyhsong
Copy link
Owner

eeyhsong commented Jul 28, 2023

HI, @toncho11,
Thanks for your help pointing out the issue.
That may be because the BCI competition iv 2a is from the competition, which means there is just ground truth of training data. But for evaluation, we need to get the test labels from the official websites.
Do you think it answers the question?
Best! 🤝

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