EEGfuseNet¶
- class torcheeg.models.EEGfuseNet(in_channels: int = 1, num_electrodes: int = 32, hid_channels_gru: int = 16, num_layers_gru: int = 1, hid_channels_cnn: int = 1, chunk_size: int = 384)[source][source]¶
EEGFuseNet: A hybrid unsupervised network which can fuse high-dimensional EEG to obtain deep feature characterization and generate similar signals. For more details, please refer to the following information.
Paper: Z. Liang, R. Zhou, L. Zhang, L. Li, G. Huang, Z. Zhang, and S. Ishii, EEGFuseNet: Hybrid Unsupervised Deep Feature Characterization and Fusion for High-Dimensional EEG With an #Application to Emotion Recognition, IEEE Transactions on Neural Systems and Rehabilitation Engineering, 29, pp. 1913-1925, 2021.
import torch from torcheeg.models.gan.eegfusenet import EEGfuseNet model = EEGfuseNet(num_electrodes=20, hid_channels_gru=16, num_layers_gru=1, hid_channels_cnn=1, chunk_size=128) input = torch.rand(2, 1, 20, 128) output, features = model(output)
- Parameters:
in_channels (int) – The number of channels of the signal corresponding to each electrode. If the original signal is used as input, in_channels is set to 1; if the original signal is split into multiple sub-bands, in_channels is set to the number of bands. (default:
1
)num_electrodes (int) – The number of electordes in input data. (default:
32
)hid_channels_gru (int) – The number of hidden nodes in BI-GRU (default:
16
)num_layers_gru (int) – The number of layers of BI-GRU. (default:
1
)hid_channels_cnn (int) – The number of filters of CNN based encoder. (default:
1
)chunk_size (int) – The number of data points included in each EEG chunk.the size of the input EEG signal is( batch size × Channel × Time) (default:
384
)
- forward(x)[source][source]¶
- Parameters:
x (torch.Tensor) – EEG signal representation, the ideal input shape is
[n, 32, 384]
. Here,n
corresponds to the batch size,32
corresponds tonum_electrodes
, and384
corresponds tochunk_size
.- Returns:
The first value is generated EEG signals. The second value is batch of extracted deep features,which used in the unsupervised EEG decoding, can represent the entire input EEG signals cross time points covering not only the EEG characteristics but also the EEG characteristics in the sequential information.
- Return type:
torch.Tensor[size of batch, number of electrodes, length of EEG signal],torch.Tensor[size of batch, length of deep feature code]