Altaheri / EEG-ATCNet

Attention temporal convolutional network for EEG-based motor imagery classification
https://ieeexplore.ieee.org/document/9852687
Apache License 2.0
173 stars 22 forks source link

Ensemble #12

Closed martinwimpff closed 1 year ago

martinwimpff commented 1 year ago

Hi @Altaheri,

thanks for making your code public. As far as I understand the code, the sliding window procedure does not only introduce n_windows more function calls but also introduces n_windows more model paramteres.

This for-loop creates a new "AT-Block" (consisting of an attention block, a TCN and a Dense layer) per window. This would effectively make your ATCNet an Ensemble model where each window would have its own "AT-Block". Is this a wanted behaviour? As far as I understood the paper I thought that there is only one "AT-Block" that is shared between all windows.

Altaheri commented 1 year ago

Yes, that's right, the feature map generated from _Convblock is divided into several windows and each window is entered into a separate "attention + TCN layer". The output from all windows is then averaged or concatenated and fed into a dense layer. The following figure may give a clearer description of the model https://www.researchgate.net/profile/Hamdi-Altaheri/publication/370976919/figure/fig1/AS:11431281160813054@1684860317357/Components-of-the-D-ATCNet-architecture-The-temporal-spatial-channel-and-spectral_W640.jpg

martinwimpff commented 1 year ago

Thanks for the clarification! It is an ensemble for both publications - right? In what sense does the second publication differ from the first one?

One other question about the data split: For subject-specific you train one model per subject on 288 trials from session_T and test on the 288 trials from session_E? For the LOSO-case you train one model per subject on 28882 trials of the other 8 subjects and test on the 288*2 trials of the "target subject"?

Altaheri commented 1 year ago

The second paper (D-ATCNet) differs from first paper (ATCNet) by using multilevel attention at the kernel level using dynamic convolution and at the features level using MSA and SE. In features level attention, we investigate the temporal, spectral, and spatial domains of the EEG signal. D-ATCNet also uses multi-head locality self-attention (MLSA) instead of multi-head self-attention, which helps learn attention representations for small datasets.

(PDF) Dynamic convolution with multilevel attention for EEG-based motor imagery decoding. Available from: https://www.researchgate.net/publication/370976919_Dynamic_convolution_with_multilevel_attention_for_EEG-based_motor_imagery_decoding [accessed Jul 05 2023].

Altaheri commented 1 year ago

That's right _"For subject-specific you train one model per subject on 288 trials from session_T and test on the 288 trials from sessionE? For the LOSO-case you train one model per subject on 288×8×2 trials of the other 8 subjects and test on the 288×2 trials of the "target subject"?"