DGCNN¶
- class torcheeg.models.DGCNN(in_channels: int = 5, num_electrodes: int = 62, num_layers: int = 2, hid_channels: int = 32, num_classes: int = 2)[source][source]¶
Dynamical Graph Convolutional Neural Networks (DGCNN). For more details, please refer to the following information.
Paper: Song T, Zheng W, Song P, et al. EEG emotion recognition using dynamical graph convolutional neural networks[J]. IEEE Transactions on Affective Computing, 2018, 11(3): 532-541.
Related Project: https://github.com/xueyunlong12589/DGCNN
Below is a recommended suite for use in emotion recognition tasks:
dataset = SEEDDataset(io_path=f'./seed', root_path='./Preprocessed_EEG', offline_transform=transforms.BandDifferentialEntropy(band_dict={ "delta": [1, 4], "theta": [4, 8], "alpha": [8, 14], "beta": [14, 31], "gamma": [31, 49] }), online_transform=transforms.Compose([ transforms.ToTensor() ]), label_transform=transforms.Compose([ transforms.Select(['emotion']), transforms.Lambda(lambda x: x + 1) ])) model = DGCNN(in_channels=5, num_electrodes=62, hid_channels=32, num_layers=2, num_classes=2)
- Parameters
in_channels (int) – The feature dimension of each electrode. (defualt:
5)num_electrodes (int) – The number of electrodes. (defualt:
62)num_layers (int) – The number of graph convolutional layers. (defualt:
2)hid_channels (int) – The number of hidden nodes in the first fully connected layer. (defualt:
32)num_classes (int) – The number of classes to predict. (defualt:
2)
- forward(x: Tensor) Tensor[source][source]¶
- Parameters
x (torch.Tensor) – EEG signal representation, the ideal input shape is
[n, 62, 5]. Here,ncorresponds to the batch size,62corresponds tonum_electrodes, and5corresponds toin_channels.- Returns
the predicted probability that the samples belong to the classes.
- Return type
torch.Tensor[number of sample, number of classes]