Skip to content

Keras_DeepConvNet.yml and Keras_ShallowConvNet.yml pipelines skipping datasets silently #1072

Open

Description

@0-1deathtouch

Hello,

I am a master's student at University of Washington, Bothell campus and I am doing my thesis on reproducibility in the field of EEG motor imagery classification via machine learning. I am attempting to reproduce your benchmark results and I am running into some problems that I was hoping you could help with.

Here is the environment I'm running in. I am using a container, so I can change environments if needed:
moabb[deeplearning] version: 1.2.0
python version: 3.10.20
OS: Debian 12 (Bookworm)

Note that I used an older version of MOABB because my desired pipeline was removed from newer versions.

I've pasted my python file and two log files. One shows the pipeline failing at Zhou2016 because it doesn't have enough events. The other shows the output when Zhou2016 is commented out to prevent the failure. AlexMI, BNCI2014_001 and PhysionetMI all fail silently, and only results for Schirrmeister2017 and Weibo2014 are output.

I tried deleting the results folder and rerunning from scratch to rule out cached results.

moabb_braindecode.py

import moabb
from moabb import benchmark
from moabb.pipelines.utils import parse_pipelines_from_directory
import mne
mne.set_config("MNE_DATA", "/gscratch/comdata/raw_data/mne_data")

results_multiclass = benchmark(
    pipelines="../pipelines", 
    paradigms=["MotorImagery"],
    evaluations=["WithinSession"],
    include_datasets=[
	"AlexMI",
	"BNCI2014_001",
	"PhysionetMI",
	"Schirrmeister2017",
	"Weibo2014",
#	"Zhou2016",
    ]
)

# Print accuracy per pipeline per dataset
print(results_multiclass.groupby(["dataset", "pipeline"])["score"].mean())

# Save to CSV for later use
results_multiclass.to_csv("results_motor_imagery.csv", index=False)

Relevant portion of moabb_braindecode_cpu_34934528.out

Traceback (most recent call last):
  File "/gscratch/comdata/users/akoser/moabb_braindecode/moabb_braindecode.py", line 27, in <module>
    results_multiclass = benchmark(
  File "/usr/local/lib/python3.10/site-packages/moabb/benchmark.py", line 190, in benchmark
    paradigm_results = context.process(
  File "/usr/local/lib/python3.10/site-packages/moabb/evaluations/base.py", line 222, in process
    process_pipeline = self.paradigm.make_process_pipelines(
  File "/usr/local/lib/python3.10/site-packages/moabb/paradigms/base.py", line 140, in make_process_pipelines
    epochs_pipeline = self._get_epochs_pipeline(return_epochs, return_raws, dataset)
  File "/usr/local/lib/python3.10/site-packages/moabb/paradigms/base.py", line 389, in _get_epochs_pipeline
    ("events", self._get_events_pipeline(dataset)),
  File "/usr/local/lib/python3.10/site-packages/moabb/paradigms/base.py", line 538, in _get_events_pipeline
    event_id = self.used_events(dataset)
  File "/usr/local/lib/python3.10/site-packages/moabb/paradigms/motor_imagery.py", line 378, in used_events
    raise (
ValueError: Dataset Zhou2016 did not have enough events in None to run analysis

moabb_braindecode_gpu_35023148.out

WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1777931155.227444   41268 cpu_feature_guard.cc:227] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F AVX512_VNNI AVX512_BF16 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
I0000 00:00:1777931164.144223   41268 gpu_device.cc:2043] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 43487 MB memory:  -> device: 0, name: NVIDIA L40S, pci bus id: 0000:84:00.0, compute capability: 8.9
Choosing from all possible events
/usr/local/lib/python3.10/site-packages/moabb/datasets/fake.py:93: RuntimeWarning: Setting non-standard config type: "MNE_DATASETS_FAKEDATASET-IMAGERY-10-2--60-60--120-120--FAKE1-FAKE2-FAKE3--C3-CZ-C4_PATH"
  set_config(key, temp_dir)
/usr/local/lib/python3.10/site-packages/moabb/datasets/fake.py:93: RuntimeWarning: Setting non-standard config type: "MNE_DATASETS_FAKEVIRTUALREALITYDATASET-P300-21-1--60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60-60--120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120-120--TARGET-NONTARGET--C3-CZ-C4_PATH"
  set_config(key, temp_dir)

Schirrmeister2017-WithinSession:   0%|          | 0/14 [00:00<?, ?it/s]
Schirrmeister2017-WithinSession:   0%|          | 0/14 [00:00<?, ?it/s]

Weibo2014-WithinSession:   0%|          | 0/10 [00:00<?, ?it/s]
Weibo2014-WithinSession:   0%|          | 0/10 [00:00<?, ?it/s]
             dataset     evaluation              pipeline  avg score
0  Schirrmeister2017  WithinSession     Keras_DeepConvNet   0.327083
1  Schirrmeister2017  WithinSession  Keras_ShallowConvNet   0.811967
2          Weibo2014  WithinSession     Keras_DeepConvNet   0.191071
3          Weibo2014  WithinSession  Keras_ShallowConvNet   0.457143
dataset            pipeline            
Schirrmeister2017  Keras_DeepConvNet       0.327083
                   Keras_ShallowConvNet    0.811967
Weibo2014          Keras_DeepConvNet       0.191071
                   Keras_ShallowConvNet    0.457143
Name: score, dtype: float32

Activity

  1. bruAristimunha commented on May 17, 2026

    @bruAristimunha
    Collaborator

    Hey @0-1deathtouch !

    To fully reproduce the moabb paper would should use the version from time of the paper. You need to check better what was the version.

    Otherwise, you should use braindecode, because we depreciate the keras implementation I think one year ago, or maybe one year and half.

    Here is some nice tutorial showing how to use braindecode and moabb:

    https://braindecode.org/stable/auto_examples/advanced_training/plot_moabb_benchmark.html

    If you need any help please let me know.

  2. bruAristimunha commented on May 17, 2026

    @bruAristimunha
    Collaborator

    For the paper, largest reproduction, we have one docker image too at docker hub.

  3. 0-1deathtouch commented on May 18, 2026

    @0-1deathtouch
    Author

    Ok thank you! I am using run.py in the docker image and I will let you know if that works.

  4. 0-1deathtouch commented on May 18, 2026

    @0-1deathtouch
    Author

    The container has two MOABBs: site-packages reports 0.5.0 and lacks Resampler_Epoch/n_jobs_evaluation which are used by run.py and /workdir/pipelines_deep/Keras_*ConvNet.yml; the source tree at /workdir/moabb/ has both. Setting PYTHONPATH=/workdir/moabb does not override the installed package. Was the environment configured for the published runs so that /workdir/moabb/ takes import precedence? And what is the version/commit of the /workdir/moabb/ source tree?

  5. 0-1deathtouch commented on Oct 3, 2026

    @0-1deathtouch
    Author

    Hi @bruAristimunha, thanks again for the earlier pointers. I'm picking this back up after a break due to illness.

    I understand braindecode is the maintained path, but for my thesis I'm reproducing the paper's results specifically, so I'm trying to stay as close to the original environment as possible.

    In the paper's container, the default MOABB in site-packages is 0.5.0, which doesn't have Resampler_Epoch or n_jobs_evaluation. Those only exist in the source tree at /workdir/moabb/, and run.py and the Keras_*ConvNet.yml pipelines need them. Which commit/version is /workdir/moabb/, and how was it meant to take import precedence (editable install, working directory, something else)?

  6. bruAristimunha commented on Oct 15, 2026

    @bruAristimunha
    Collaborator

    Hi @0-1deathtouch, sorry for the slow answer, and I hope you are feeling better. We went back into the image itself to answer this precisely.

    What baristimunha/moabb:latest contains (the only tag, built 2023-08-15, Python 3.8, nvcr.io/nvidia/pytorch:22.11-py3 base), read from the image's build history and layers:

    1. ADD . /workdir: a copy of a local MOABB checkout. Its .git is inside the layer: /workdir/.git/refs/heads/develop = 01e289933507a064883019e04f07c746cefdf741 (2023-08-04, "FIX empty dataset_list in python3.10 (FIX empty dataset_list in python3.10 #449)"). Compared with that commit, the moabb/ package is unchanged except moabb/run.py (the paper's launcher, see below) and two added helper files (moabb/run_little_toy.py, moabb/start_training.sh). pipelines_deep/Keras_*.yml are identical to pipelines/Keras_*.yml at that commit.
    2. Then pip3 install moabb[deepleaning] (typo in the extra, so plain moabb) from PyPI, which is the 0.5.0 you see in site-packages (with mne 1.5.0, pyriemann 0.3, scikit-learn 1.3.0, numpy 1.24.4). The later git+https://github.com/NeuroTechX/moabb line found moabb already installed and did not replace it.

    How /workdir/moabb took precedence: not through PYTHONPATH. The jobs were started through /workdir/moabb/start_training.sh, which does

    pip uninstall -y -q moabb
    cd /workdir/
    pip install -q .
    # then runs the command passed as arguments, e.g.
    # python /workdir/moabb/run.py --pipelines /workdir/pipelines_deep ...

    So inside the container, either use that script or run the same two lines yourself:

    pip uninstall -y moabb && pip install /workdir
    python -c "from moabb.pipelines.features import Resampler_Epoch; print('ok')"   # both trees report version 0.5.0; this import only works with the /workdir build
    python /workdir/moabb/run.py --pipelines /workdir/pipelines_deep --results <out> --output <out> --mne_data <data> --dataset Schirrmeister2017 --paradigm MotorImagery

    What the modified run.py does (worth knowing to match the published numbers): evaluations=['WithinSession'], n_jobs_evaluation=1, one dataset per job via --dataset (keys BNCI2014001, MunichMI, PhysionetMI, Schirrmeister2017, Cho2017, Lee2019_MI, Weibo2014, Shin2017A), and a context file chosen by --paradigm: /workdir/contexts/mi_all.yml by default (4 classes: left_hand, right_hand, feet, hands), mi_rh_lh.yml for LeftRightImagery, mi_rh_f.yml for MotorImagery3 (right_hand vs feet). Results go to <output>/<dataset>_deep_<paradigm>.csv. This also explains your first error: with the default paradigm (n_classes=None), Zhou2016 does not have the events; the paper runs pass explicit class lists through those contexts.

    Outside the container, the closest installable version is that exact commit:

    pip install "moabb[deeplearning] @ git+https://github.com/NeuroTechX/moabb@01e289933507a064883019e04f07c746cefdf741"

    The nearest release is v1.0.0 (2023-10-23): it contains that commit, still has Resampler_Epoch, n_jobs_evaluation and the Keras pipelines (n_jobs_evaluation was removed in #588, May 2024, so 1.1.0+ will not work with this run.py), but it also includes ~2.5 months of later changes, so the commit above is the safer choice for an exact reproduction. Keep the TensorFlow/Keras stack of the image (the last layer installs tensorrt tensorflow torch scikeras codecarbon), since newer TensorFlow versions changed the Keras API these pipelines use.

    If something still does not match the paper's tables, post the dataset, paradigm and the scores you get, and we will compare with our result files.

  7. 0-1deathtouch commented on Oct 17, 2026

    @0-1deathtouch
    Author

    Hello @bruAristimunha,

    Excellent, thank you for digging into the image! This did resolve the import question and I’m now running the unmodified run.py. I’ll post an update once the runs finish.

  8. 0-1deathtouch commented on Oct 20, 2026

    @0-1deathtouch
    Author

    Hi @bruAristimunha, thanks again for the detailed answer.

    Some dataset-paradigm pairs reproduced successfully:

    • Left vs right (Table D2). BNCI2014001, Schirrmeister2017 and Weibo2014 match all six deep pipelines. For example, ShallowConvNet is 86.1 / 84.8 / 79.1 vs the paper’s 86.17 / 84.82 / 79.10, and DeepConvNet is 81.4 / 81.6 / 72.9 vs 82.07 / 81.23 / 73.64
    • PhysionetMI, 4 classes (Table D1). All six pipelines match. For example, ShallowConvNet is 41.9 vs 41.87

    Unfortunately, multiclass Weibo2014 does not reproduce right now. Scores are 7 to 17 points higher than the paper’s, for every pipeline. With --paradigm MotorImagery (mi_all.yml) I get 316 samples per session, so 4 classes. The paper’s EEGTCNet and DeepConvNet scores are at or below the 25% chance level for 4 balanced classes, so I wonder whether D1 used more labels for Weibo. Table 1 lists 4(7), but I couldn’t find where the text says what the parentheses mean.

    pipeline mine paper
    ShallowConvNet 65.1 48.94
    DeepConvNet 37.0 24.17
    EEGNex 38.3 30.22

    Open Questions:

    1. Which event list produced the “all labels” numbers in D1 for each dataset? BNCI2014-001 and Schirrmeister2017 have no hands event, so mi_all.yml drops them with “No datasets left after paradigm and evaluation checks”. Table 1 lists them with 3(4) classes. Which context file or class list was used for those, and for Weibo2014 (4 or 7 classes)?
    2. AlexMI and Zhou2016 are not in the --dataset dict of /workdir/moabb/run.py. How were they selected for the paper? I plan to add just those two entries ("AlexMI": "Alexandre Motor Imagery", "Zhou2016": "Zhou 2016") and change nothing else, unless you’d suggest otherwise.
    3. PhysionetMI with --paradigm LeftRightImagery fails on subject 1 with ValueError: Could not find any of the events you specified. raised from mne.events_from_annotations in moabb/datasets/preprocessing.py (line 81). Was Physionet left/right run for the paper with a different setup?

    Happy to share the CSVs or the Slurm and def files if that’s useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions