EFDiscriminator¶
- class torcheeg.models.EFDiscriminator(in_channels: int = 1, num_electrodes: int = 32, hid_channels_cnn: int = 1, chunk_size: int = 384)[source][source]¶
EFDiscriminator: the discriminator that comes with EEGFuseNet is to distinguish whether the input EEG signals is a fake one generated by the eegfusenet or a real one collected from human brain.
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.
g_model=EEGfuseNet(num_electrodes=20,hid_channels_gru=16,num_layers_gru=1,hid_channels_cnn=1,chunk_size=128) d_model = EFDiscriminator(num_electrodes=20,hid_channels_cnn=1,chunk_size=128) X = torch.rand(128,1,20,128) fake_X,deep_feature=g_model(X) p_real,p_fake = d_model(X),d_model(fake_X)
- 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 electrodes. (default:
32
)hid_channels_cnn (int) – The number of filters in CNN based encoder. (default:
1
)chunk_size (int) – Number of data points included in each EEG chunk. (default:
384
)
- forward(x)[source][source]¶
- Parameters:
x (torch.Tensor) – EEG signal representation or the fake generated EEGsignal, the size of the input EEG signal is( batch size × Channel × Time) whose ideal input shape is
[n, 32, 384]
. Here,n
corresponds to the batch size,32
corresponds tonum_electrodes
, and384
corresponds tochunk_size
.- Returns:
The possibilities that model judging the corresponding input signals is real.
- Return type:
torch.Tensor[size of batch, 1]