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): ...@@ -204,7 +204,7 @@ class BrainMapperUNet3D(nn.Module):
self.bottleneck = modules.ConvolutionalBlock3D(parameters) 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.decoderBlock1 = modules.DecoderBlock3D(parameters)
self.decoderBlock2 = modules.DecoderBlock3D(parameters) self.decoderBlock2 = modules.DecoderBlock3D(parameters)
self.decoderBlock3 = modules.DecoderBlock3D(parameters) self.decoderBlock3 = modules.DecoderBlock3D(parameters)
...@@ -311,21 +311,23 @@ class BrainMapperUNet3D(nn.Module): ...@@ -311,21 +311,23 @@ class BrainMapperUNet3D(nn.Module):
return prediction return prediction
# if __name__ == '__main__': if __name__ == '__main__':
# # For debugging - To be deleted later! TODO # For debugging - To be deleted later! TODO
# parameters = { parameters = {
# 'kernel_heigth': 5, 'kernel_heigth': 5,
# 'kernel_width': 5, 'kernel_width': 5,
# 'kernel_classification': 1, 'kernel_depth': 5,
# 'input_channels': 1, 'kernel_classification': 1,
# 'output_channels': 64, 'input_channels': 1,
# 'convolution_stride': 1, 'output_channels': 64,
# 'dropout': 0.2, 'convolution_stride': 1,
# 'pool_kernel_size': 2, 'dropout': 0.2,
# 'pool_stride': 2, 'pool_kernel_size': 2,
# 'up_mode': 'upconv', 'pool_stride': 2,
# 'number_of_classes': 1 'up_mode': 'upconv',
# } 'number_of_classes': 1
# network = BrainMapperUNet(parameters) }
network = BrainMapperUNet3D(parameters)
...@@ -293,6 +293,7 @@ class ClassifierBlock(nn.Module): ...@@ -293,6 +293,7 @@ class ClassifierBlock(nn.Module):
return logits return logits
class ConvolutionalBlock3D(nn.Module): class ConvolutionalBlock3D(nn.Module):
"""Parent class for a 3D convolutional block. """Parent class for a 3D convolutional block.
...@@ -324,7 +325,7 @@ class ConvolutionalBlock3D(nn.Module): ...@@ -324,7 +325,7 @@ class ConvolutionalBlock3D(nn.Module):
padding_depth = int((parameters['kernel_depth'] - 1) / 2) padding_depth = int((parameters['kernel_depth'] - 1) / 2)
self.output_channels = parameters['output_channels'] self.output_channels = parameters['output_channels']
self.convolutional_layer = nn.Conv2d( self.convolutional_layer = nn.Conv3d(
in_channels=parameters['input_channels'], in_channels=parameters['input_channels'],
out_channels=parameters['output_channels'], out_channels=parameters['output_channels'],
kernel_size=(parameters['kernel_depth'], kernel_size=(parameters['kernel_depth'],
...@@ -333,6 +334,7 @@ class ConvolutionalBlock3D(nn.Module): ...@@ -333,6 +334,7 @@ class ConvolutionalBlock3D(nn.Module):
stride=parameters['convolution_stride'], stride=parameters['convolution_stride'],
padding=(padding_depth, padding_heigth, padding_width) padding=(padding_depth, padding_heigth, padding_width)
) )
self.activation = nn.PReLU() self.activation = nn.PReLU()
# Other activation functions which might be interesting to test: # 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