Skip to content

Commit

Permalink
Updating mne_bids version (#586)
Browse files Browse the repository at this point in the history
* Updating mne_bids version

* Accepting mne 1.7

* Updating whats new file

* Enforce moabb 1.7

* Enforce moabb 1.7

* Adding edfio as a dependency

* Update pyproject.toml

Co-authored-by: Bru <[email protected]>

* Update pyproject.toml

* Updating versions: keras, scikeras, tensorflow, h5py

* Updating versions: keras, scikeras, tensorflow, h5py

* Defining tensorflow-io-gcs-filesystem version

* Defining tensorflow-io-gcs-filesystem version

* Updating to Keras 3 optimizers

* Updating code Keras3

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Updating code Keras3

* Updating to Keras 3 functions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

---------

Co-authored-by: Bru <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored May 29, 2024
1 parent dea490b commit 03b1f48
Show file tree
Hide file tree
Showing 16 changed files with 376 additions and 334 deletions.
2 changes: 2 additions & 0 deletions docs/source/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Bugs
- Fix number of sessions in doc of :class:`moabb.datasets.Sosulski2019` (:gh:`565` by `Pierre Guetschel`_)
- Fix `code` column of :class:`moabb.datasets.CastillosCVEP100` and :class:`moabb.datasets.CastillosCVEP100` (:gh:`567` by `Pierre Guetschel`_)
- MAINT updating the packages pre-release (:gh:`578` by `Bruno Aristimunha`_)
- Fix mne_bids version incompatibility with mne (:gh:`586` by `Bruna Lopes`_)
- Updating the parameters of the SSVEP_TRCA method (:gh:`589` by `Bruno Aristimunha`_)
- Fix and updating the parameters for the benchmark function (:gh:`588` by `Bruno Aristimunha`_)
- Fix :class:`moabb.datasets.preprocessing.SetRawAnnotations` setting incorrect annotations when the dataset's interval does not start at 0 (:gh:`607` by `Pierre Guetschel`_)
Expand Down Expand Up @@ -449,4 +450,5 @@ API changes
.. _Jordy Thielen: https://github.com/thijor
.. _Sebastien Velut: https://github.com/swetbear
.. _Brian Irvine: https://github.com/brianjohannes
.. _Bruna Lopes: https://github.com/brunaafl
.. _Yash Chauhan: https://github.com/jiggychauhi
2 changes: 1 addition & 1 deletion examples/pipelines_DL/Keras_DeepConvNet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 2
Expand Down
2 changes: 1 addition & 1 deletion examples/pipelines_DL/Keras_EEGITNet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 2
Expand Down
2 changes: 1 addition & 1 deletion examples/pipelines_DL/Keras_EEGNeX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 2
Expand Down
2 changes: 1 addition & 1 deletion examples/pipelines_DL/Keras_EEGNet_8_2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 2
Expand Down
2 changes: 1 addition & 1 deletion examples/pipelines_DL/Keras_EEGTCNet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 2
Expand Down
2 changes: 1 addition & 1 deletion examples/pipelines_DL/Keras_ShallowConvNet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 2
Expand Down
28 changes: 15 additions & 13 deletions moabb/pipelines/deep_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from typing import Any, Dict

import tensorflow as tf
from keras import backend as K
from keras.constraints import max_norm
from keras.layers import (
Activation,
Expand All @@ -31,7 +30,9 @@
Permute,
)
from keras.models import Model, Sequential
from keras.ops import pad
from scikeras.wrappers import KerasClassifier
from tensorflow.keras import backend as K

from moabb.pipelines.utils_deep_model import EEGNet, EEGNet_TC, TCN_block

Expand Down Expand Up @@ -728,15 +729,15 @@ def _keras_build_fn(self, compile_kwargs: Dict[str, Any]):

# ================================

paddings = tf.constant([[0, 0], [0, 0], [3, 0], [0, 0]])
block = tf.pad(block_in, paddings, "CONSTANT")
paddings = [[0, 0], [0, 0], [3, 0], [0, 0]]
block = pad(block_in, paddings, "constant")
block = DepthwiseConv2D(
(1, 4), padding="valid", depth_multiplier=1, dilation_rate=(1, 1)
)(block)
block = BatchNormalization()(block)
block = Activation("elu")(block)
block = Dropout(0.4)(block)
block = tf.pad(block, paddings, "CONSTANT")
block = pad(block, paddings, "constant")
block = DepthwiseConv2D(
(1, 4), padding="valid", depth_multiplier=1, dilation_rate=(1, 1)
)(block)
Expand All @@ -745,15 +746,16 @@ def _keras_build_fn(self, compile_kwargs: Dict[str, Any]):
block = Dropout(self.drop_rate)(block)
block_out = Add()([block_in, block])

paddings = tf.constant([[0, 0], [0, 0], [6, 0], [0, 0]])
block = tf.pad(block_out, paddings, "CONSTANT")
paddings = [[0, 0], [0, 0], [6, 0], [0, 0]]
block = pad(block_out, paddings, "constant")
block = DepthwiseConv2D(
(1, 4), padding="valid", depth_multiplier=1, dilation_rate=(1, 2)
)(block)
block = BatchNormalization()(block)
block = Activation("elu")(block)
block = Dropout(self.drop_rate)(block)
block = tf.pad(block, paddings, "CONSTANT")
print(block.dtype)
block = pad(block, paddings, "constant")
block = DepthwiseConv2D(
(1, 4), padding="valid", depth_multiplier=1, dilation_rate=(1, 2)
)(block)
Expand All @@ -762,15 +764,15 @@ def _keras_build_fn(self, compile_kwargs: Dict[str, Any]):
block = Dropout(self.drop_rate)(block)
block_out = Add()([block_out, block])

paddings = tf.constant([[0, 0], [0, 0], [12, 0], [0, 0]])
block = tf.pad(block_out, paddings, "CONSTANT")
paddings = [[0, 0], [0, 0], [12, 0], [0, 0]]
block = pad(block_out, paddings, "constant")
block = DepthwiseConv2D(
(1, 4), padding="valid", depth_multiplier=1, dilation_rate=(1, 4)
)(block)
block = BatchNormalization()(block)
block = Activation("elu")(block)
block = Dropout(self.drop_rate)(block)
block = tf.pad(block, paddings, "CONSTANT")
block = pad(block, paddings, "constant")
block = DepthwiseConv2D(
(1, 4), padding="valid", depth_multiplier=1, dilation_rate=(1, 4)
)(block)
Expand All @@ -779,15 +781,15 @@ def _keras_build_fn(self, compile_kwargs: Dict[str, Any]):
block = Dropout(self.drop_rate)(block)
block_out = Add()([block_out, block])

paddings = tf.constant([[0, 0], [0, 0], [24, 0], [0, 0]])
block = tf.pad(block_out, paddings, "CONSTANT")
paddings = [[0, 0], [0, 0], [24, 0], [0, 0]]
block = pad(block_out, paddings, "constant")
block = DepthwiseConv2D(
(1, 4), padding="valid", depth_multiplier=1, dilation_rate=(1, 8)
)(block)
block = BatchNormalization()(block)
block = Activation("elu")(block)
block = Dropout(self.drop_rate)(block)
block = tf.pad(block, paddings, "CONSTANT")
block = pad(block, paddings, "constant")
block = DepthwiseConv2D(
(1, 4), padding="valid", depth_multiplier=1, dilation_rate=(1, 8)
)(block)
Expand Down
2 changes: 1 addition & 1 deletion pipelines/Keras_DeepConvNet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 300
Expand Down
2 changes: 1 addition & 1 deletion pipelines/Keras_EEGITNet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 300
Expand Down
2 changes: 1 addition & 1 deletion pipelines/Keras_EEGNeX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 300
Expand Down
2 changes: 1 addition & 1 deletion pipelines/Keras_EEGNet_8_2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 300
Expand Down
2 changes: 1 addition & 1 deletion pipelines/Keras_EEGTCNet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 300
Expand Down
2 changes: 1 addition & 1 deletion pipelines/Keras_ShallowConvNet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline:
loss: "sparse_categorical_crossentropy"
optimizer:
- name: Adam
from: tensorflow.keras.optimizers.legacy
from: tensorflow.keras.optimizers
parameters:
learning_rate: 0.001
epochs: 300
Expand Down
Loading

0 comments on commit 03b1f48

Please sign in to comment.