Hi @Ahmed,
Note: I am currently using Matlab Mobile and cwtLayer requires Wavelet Toolbox which I don’t have access to.
However, going through your comments and snippet code provided, bear in mind that each EEG record is a 1D signal of length 4000, when creating mini-batches, it would be beneficial to structure them in a way that respects the input requirements of the sequence layer. For example, if you choose to structure your batches in the 'CTB' format, each batch could have a shape of `[1, 4000, N]`, where `N` is the number of samples in your batch (the batch size). This means: ‘1`: Represents the single channel, ‘4000`: The length of each EEG signal, `N`: The number of samples in each mini-batch.
In your `processMB` function, you should ensure that when reshaping the `Xcell`, it aligns with the expected input shape. The line where you permute `dlX` should ensure that it has dimensions `[1, 4000, N]` if you're following the CTB format. The current implementation reshapes `Xcell` into `[1 x 1 x T]`, which is correct if you're aiming for compatibility with subsequent layers.
Here are some additional tips that might help.
Data Preparation: Ensure that your preprocessing steps adequately prepare your data for CWT and CNN layers. The CWT layer expects an appropriately shaped input to compute wavelet transforms effectively.
Batch Size: Choose a batch size that fits within your computational resources while ensuring efficient training dynamics. A common choice for time-series data might range from 32 to 128 samples per batch.
Model Training Dynamics: Monitor loss and accuracy metrics during training to ensure that your batching strategy effectively captures temporal dependencies in EEG signals.
Hope these tips will help resolve your problem.