# -*- coding: utf-8 -*-
#  Default values are set internally, if the corresponding parameter is not found in the configuration file.

#  [Optional but highly suggested] The name will be used in the filenames when saving the model.
#  Default: "cnnModel"
modelName = "deepMedic"

#  [Required] The main folder that the output will be placed.
folderForOutput = "../../../output/"


#  ================ MODEL PARAMETERS =================

#  [Required] The number of classes in the task. Including background!
numberOfOutputClasses = 5
#  [Required] The number of input channels, eg number of MRI modalities.
numberOfInputChannels = 2

#  +++++++++++Normal pathway+++++++++++
#  [Required] This list should have as many entries as the number of layers I want the normal-pathway to have.
#  Each entry is an integer that specifies the number of Feature Maps to use in each of the layers.
numberFMsPerLayerNormal = [30, 30, 40, 40, 40, 40, 50, 50]
#  [Required] This list should have as many entries as the number of layers in the normal pathway.
#  Each entry should be a sublist with 3 entries. These should specify the dimensions of the kernel at the corresponding layer.
kernelDimPerLayerNormal = [[3,3,3], [3,3,3], [3,3,3], [3,3,3], [3,3,3], [3,3,3], [3,3,3], [3,3,3]]

#  [Optional] List with number of layers, at the output of which to make a residual connection with the input of the previous layer. Ala Kaiming He et al, "Deep Residual Learning for Image Recognition".
#  Note: Numbering starts from 1 for the first layer, which is not an acceptable value (no previous layer).
#  Example: [4,6,8] will connect (add) to the output of Layer 4 the input of Layer 3. Also, input to 5th will be added to output of 6th, and input of 7th to output of 8th.
#  Default: [], no residual connections
layersWithResidualConnNormal = [4,6,8]

#  [Optional] Layers to make of lower rank. Ala Yani Ioannou et al, "Training CNNs with Low-Rank Filters For Efficient Image Classification".
#  Example: [3,5] will make the 3rd and 5th layers of lower rank.
#  Default: []
lowerRankLayersNormal = []

#  +++++++++++Subsampled pathway+++++++++++
#  [Optional] Specify whether to use a subsampled pathway. If False, all subsampled-related parameters will be read but disregarded in the model-construction.
#  Default: False
useSubsampledPathway = True

#  [Optionals] The below parameters specify the subsampled-pathway architecture in a similar way as the normal.
#  If they are ommitted and useSubsampledPathway is set to True, the subsampled pathway will be made similar to the normal pathway (suggested for easy use).
#  [WARN] Subsampled pathway MUST have the same size of receptive field as the normal. Limitation in the code. User could easily specify different number of FMs. But care must be given if number of layers is changed. In this case, kernel sizes should also be adjusted to achieve same size of Rec.Field.
numberFMsPerLayerSubsampled = [30, 30, 40, 40, 40, 40, 50, 50]
kernelDimPerLayerSubsampled = [[3,3,3], [3,3,3], [3,3,3], [3,3,3], [3,3,3], [3,3,3], [3,3,3], [3,3,3]]

#  [Optional] How much to downsample the image that the subsampled-pathway processes.
#  Requires either a) list of 3 integers, or b) list of lists of 3 integers.
#  Input example a) [3,3,3]   Creates one additional parallel pathway, where input is subsampled by 3 in the x,y,z axis (the 3 elements of the list).
#  Input example b) [[3,3,3], [5,5,5]]   Creates two additional parallel pathways. One with input subsampled by [3,3,3], and one subsampled by [5,5,5]. If not specified, each path mirrors the previous.
#  Default: [[3,3,3]]
subsampleFactor = [[3,3,3],[5,5,5]]

#  [Optional] Residual Connections for subsampled pathway. See corresponding parameter for normal pathway.
#  Default: mirrors the normal pathway, no residual connections
layersWithResidualConnSubsampled = [4,6,8]

#  [Optional] Layers to make of lower rank. See corresponding parameter for normal pathway.
#  Default: Mirrors the normal pathway
#lowerRankLayersSubsampled = []

#  +++++++++++ Final Classification (FC) Pathway +++++++++++
#  [Optional] After the last layers of the normal and subsampled pathways are concatenated, additional hidden layers can be added before the final classification layer.
#  Specify a list, with as many entries as the number of ADDITIONAL HIDDEN FC layers (other than the classification layer) to add. Entries specify the number of Feature Maps to use.
#  Default: []
numberFMsPerLayerFC = [250, 250]

#  [Optional] Specify dimensions of kernels in the last hidden layers, between concatenation of multi-scale features and the output SoftMax.
#  Note: Should have as many sublists as the number of layers in the path. Equal to integers in list (numberFMsPerLayerFC), +1 for the final classification layer.
#  Default: [[1,1,1]]
kernelDimPerLayerFC = [[3,3,3],[1,1,1],[1,1,1]]

#  [Optional] Specify what type of padding (if any) to use in each conv layer of the FC pathway to preserve output's shape equal to input's.
#  Possible values: None: no padding, 'zero': pads with zeros, 'mirror': pads by mirroring the edges of the feature maps.
#  NOTE: As many elements as the 'numberFMsPerLayerFC' PLUS 1, for the final classification layer.
#  Default: [None, None, ...] for all layers, which means no padding.
padTypePerLayerFC = ['mirror', None, None]

#  [Optional] Residual Connections for the FC hidden layers. See corresponding parameter for normal pathway.
#  Default: [], no connections.
layersWithResidualConnFC = [2]

#  +++++++++++Size of Image Segments+++++++++++
#  DeepMedic does not process patches of the image, but larger image-segments. Specify their size here.

#  [Required] Size of training segments influence the captured distribution of samples from the different classes (see DeepMedic paper)
segmentsDimTrain = [37,37,37]
#  [Optional] The size of segments to use during the validation-on-samples process that is performed throughout training if requested.
#  Default: equal to receptive field, to validate on patches.
segmentsDimVal = [17,17,17]
#  [Optional] Bigger image segments for Inference are safe to use and only speed up the process. Only limitation is the GPU memory.
#  Default: equal to the training segment.
segmentsDimInference = [45,45,45]


#  [Optionals] Dropout Rates on the input connections of the various layers. Each list should have as many entries as the number of layers in the corresponding pathway.
#  0 = no dropout. 1= 100% drop of the neurons. Empty list for no dropout.
#  Default: []
dropoutRatesNormal = []
dropoutRatesSubsampled = []
#  Default: 50% dropout on every layer of the Final Classification (FC) Pathway except for the first one after the concatenation.
#  Note: The list for FC rates should have one additional entry in comparison to "numberFMsPerLayerFC", for the classification layer.
dropoutRatesFc = [0.0, 0.5, 0.5]

#  [Optional] Initialization method for the conv kernel weights.
#  Options: ["normal", std] for sampling from N(0, std). ["fanIn", scale] for scaling variance with (scale/fanIn). Eg ["fanIn", 2] initializes ala "Delving Deep into Rectifiers".
#  Default: ["fanIn", 2]
convWeightsInit = ["fanIn", 2]
#  [Optional] Activation Function for all convolutional layers. Allowed: "linear", "relu", "prelu", "elu", "selu"
#  Default: "prelu"
activationFunction = "prelu"

#  [Optional] Batch Normalization uses a rolling average of the mus and std for inference.
#  Specify over how many batches (SGD iterations) this moving average should be computed. Value <= 0 disables BN.
#  Default : 60
rollAverageForBNOverThatManyBatches = 60

