Commit 6406ec01 authored by Andrei-Claudiu Roibu's avatar Andrei-Claudiu Roibu 🖥
Browse files

fixed bug - float network parameter rather than int/tuple

parent 2119e409
......@@ -204,7 +204,7 @@ class BrainMapperUNet3D(nn.Module):
self.bottleneck = modules.ConvolutionalBlock3D(parameters)
parameters['input_channels'] = parameters['output_channels'] * 2.0
parameters['input_channels'] = parameters['output_channels'] * 2
self.decoderBlock1 = modules.DecoderBlock3D(parameters)
self.decoderBlock2 = modules.DecoderBlock3D(parameters)
self.decoderBlock3 = modules.DecoderBlock3D(parameters)
......@@ -311,21 +311,23 @@ class BrainMapperUNet3D(nn.Module):
return prediction
# if __name__ == '__main__':
# # For debugging - To be deleted later! TODO
# parameters = {
# 'kernel_heigth': 5,
# 'kernel_width': 5,
# 'kernel_classification': 1,
# 'input_channels': 1,
# 'output_channels': 64,
# 'convolution_stride': 1,
# 'dropout': 0.2,
# 'pool_kernel_size': 2,
# 'pool_stride': 2,
# 'up_mode': 'upconv',
# 'number_of_classes': 1
# }
# network = BrainMapperUNet(parameters)
if __name__ == '__main__':
# For debugging - To be deleted later! TODO
parameters = {
'kernel_heigth': 5,
'kernel_width': 5,
'kernel_depth': 5,
'kernel_classification': 1,
'input_channels': 1,
'output_channels': 64,
'convolution_stride': 1,
'dropout': 0.2,
'pool_kernel_size': 2,
'pool_stride': 2,
'up_mode': 'upconv',
'number_of_classes': 1
}
network = BrainMapperUNet3D(parameters)
......@@ -293,6 +293,7 @@ class ClassifierBlock(nn.Module):
return logits
class ConvolutionalBlock3D(nn.Module):
"""Parent class for a 3D convolutional block.
......@@ -324,7 +325,7 @@ class ConvolutionalBlock3D(nn.Module):
padding_depth = int((parameters['kernel_depth'] - 1) / 2)
self.output_channels = parameters['output_channels']
self.convolutional_layer = nn.Conv2d(
self.convolutional_layer = nn.Conv3d(
in_channels=parameters['input_channels'],
out_channels=parameters['output_channels'],
kernel_size=(parameters['kernel_depth'],
......@@ -333,6 +334,7 @@ class ConvolutionalBlock3D(nn.Module):
stride=parameters['convolution_stride'],
padding=(padding_depth, padding_heigth, padding_width)
)
self.activation = nn.PReLU()
# Other activation functions which might be interesting to test:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment