Esempio n. 1
0
def test_eegnet_v4():
    rng = np.random.RandomState(42)
    n_channels = 18
    n_in_times = 500
    n_classes = 2
    n_samples = 7
    X = rng.randn(n_samples, n_channels, n_in_times, 1)
    X = torch.Tensor(X.astype(np.float32))
    model = EEGNetv4(n_channels, n_classes, input_window_samples=n_in_times)
    y_pred = model(X)
    assert y_pred.shape == (n_samples, n_classes)
Esempio n. 2
0
def test_eegnet_v4(input_sizes):
    model = EEGNetv4(input_sizes['n_channels'],
                     input_sizes['n_classes'],
                     input_window_samples=input_sizes['n_in_times'])
    check_forward_pass(model, input_sizes)
Esempio n. 3
0
batch_size = 32
n_epochs = 200

#one_window.shape : (208, 500)

# Extract number of chans and time steps from dataset
one_window = next(iter(train_loader))[0]
n_chans = one_window.shape[1]
input_window_samples = one_window.shape[2]

model_name = 'deepnet_da'
if model_name == 'eegnet':
    #print('Here')
    net = EEGNetv4(n_chans,
                   class_number,
                   input_window_samples=input_window_samples,
                   final_conv_length='auto',
                   drop_prob=0.5)
elif model_name == 'shallowFBCSPnet':
    net = ShallowFBCSPNet(
        n_chans,
        class_number,
        input_window_samples=input_window_samples,
        final_conv_length='auto',
    )  # 51%
elif model_name == 'deepnet':
    net = deepnet(n_chans, class_number, wind)  # 81%
elif model_name == 'deepnet_changeDepth':
    net = deepnet_changeDepth(n_chans, class_number, wind, depth)  # 81%
    model_name = 'deepnet_changeDepth_' + str(depth)
elif model_name == 'deepnet2':