code
stringlengths
3
6.57k
Encoder(nn.Module)
super(Encoder, self)
__init__()
nn.MaxPool2d(kernel_size=downsample_kernel)
nn.Conv2d(in_channels, middle_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(middle_channels)
nn.ReLU(inplace=True)
nn.Conv2d(middle_channels, out_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(out_channels)
nn.ReLU(inplace=True)
layers.append(nn.Dropout2d(p=dropout)
nn.Sequential(*layers)
forward(self, x)
self.encoder(x)
Center(nn.Module)
__init__(self, in_channels, middle_channels, out_channels, deconv_channels, dropout=False)
super(Center, self)
__init__()
nn.MaxPool2d(kernel_size=2)
nn.Conv2d(in_channels, middle_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(middle_channels)
nn.ReLU(inplace=True)
nn.Conv2d(middle_channels, out_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(out_channels)
nn.ReLU(inplace=True)
nn.ConvTranspose2d(out_channels, deconv_channels, kernel_size=2, stride=2)
layers.append(nn.Dropout2d(p=dropout)
nn.Sequential(*layers)
forward(self, x)
self.center(x)
Decoder(nn.Module)
__init__(self, in_channels, middle_channels, out_channels, deconv_channels, dropout=False)
super(Decoder, self)
__init__()
nn.Conv2d(in_channels, middle_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(middle_channels)
nn.ReLU(inplace=True)
nn.Conv2d(middle_channels, out_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(out_channels)
nn.ReLU(inplace=True)
nn.ConvTranspose2d(out_channels, deconv_channels, kernel_size=2, stride=2)
layers.append(nn.Dropout2d(p=dropout)
nn.Sequential(*layers)
forward(self, x)
self.decoder(x)
Last(nn.Module)
__init__(self, in_channels, middle_channels, out_channels, softmax=False)
super(Last, self)
__init__()
nn.Conv2d(in_channels, middle_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(middle_channels)
nn.ReLU(inplace=True)
nn.Conv2d(middle_channels, middle_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(middle_channels)
nn.ReLU(inplace=True)
nn.Conv2d(middle_channels, out_channels, kernel_size=1)
nn.Sigmoid()
layers.append(nn.Softmax2d()
nn.Sequential(*layers)
forward(self, x)
self.first(x)
UNet(nn.Module)
__init__(self, in_channels, out_channels, softmax=False)
super(UNet, self)
__init__()
First(in_channels, 64, 64)
Encoder(64, 128, 128)
Encoder(128, 256, 256)
Encoder(256, 512, 512)
Center(512, 1024, 1024, 512)
Decoder(1024, 512, 512, 256)
Decoder(512, 256, 256, 128)
Decoder(256, 128, 128, 64)
Last(128, 64, out_channels, softmax=softmax)
forward(self, x)
self.first(x)
self.encoder_1(x_first)
self.encoder_2(x_enc_1)
self.encoder_3(x_enc_2)
self.center(x_enc_3)
self.decoder_3(torch.cat([pad_to_shape(x_cent, x_enc_3.shape)
self.decoder_2(torch.cat([pad_to_shape(x_dec_3, x_enc_2.shape)
self.decoder_1(torch.cat([pad_to_shape(x_dec_2, x_enc_1.shape)
self.last(torch.cat([pad_to_shape(x_dec_1, x_first.shape)
BSD (3-clause)
import (complete_behavior, get_events_interactions)
op.join(path_data + 'results/' + subject + output_folder)
os.path.exists(results_folder)
os.makedirs(results_folder)
op.join(path_data, subject, 'behavior_Target.hdf5')
read_hdf5(fname)
complete_behavior(events)
get_events_interactions(events)
op.join(path_data, subject, 'epochs_Target.fif')
mne.read_epochs(fname)
epochs_target.pick_types(meg=True, ref_meg=False)
epochs_target.crop(-0.2, 0.9)
op.join(path_data, subject, 'epochs_Cue.fif')
mne.read_epochs(fname)
epochs_cue.pick_types(meg=True, ref_meg=False)