modelConfig.cfg 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # -*- coding: utf-8 -*-
  2. # Default values are set internally, if the corresponding parameter is not found in the configuration file.
  3. # [Optional but highly suggested] The name will be used in the filenames when saving the model.
  4. # Default: "cnnModel"
  5. modelName = "model_name"
  6. # [Required] The main folder that the output will be placed.
  7. folderForOutput = "../output/"
  8. # ================ MODEL PARAMETERS =================
  9. # [Required] The number of classes in the task. Including background!
  10. numberOfOutputClasses = 19 # see C:\Users\DTHUFF\Documents\Research\Projects\semi_sup_segmentation\visercal3\Documentation\radLexIDs.xlsx
  11. # 0=background
  12. # 1=liver
  13. # 2=spleen
  14. # 3=lung
  15. # 4=Thyroid
  16. # 5=kidney
  17. # 6=Pancreas
  18. # 7=Gallbladder ##
  19. # 8=Bladder
  20. # 9=Aorta
  21. # 10=Trachea
  22. # 11=Sternum ##
  23. # 12=vertebra L1 ##
  24. # 13=adrenal ##
  25. # 14=psoas major
  26. # 15=Rectus
  27. # 16=Bowel
  28. # 17=Stomach
  29. # 18=Heart ##
  30. # [Required] The number of input channels, eg number of MRI modalities.
  31. numberOfInputChannels = 1
  32. # +++++++++++Normal pathway+++++++++++
  33. # [Required] This list should have as many entries as the number of layers I want the normal-pathway to have.
  34. # Each entry is an integer that specifies the number of Feature Maps to use in each of the layers.
  35. numberFMsPerLayerNormal = [30, 30, 40, 40, 40, 40, 50, 50]
  36. # [Required] This list should have as many entries as the number of layers in the normal pathway.
  37. # Each entry should be a sublist with 3 entries. These should specify the dimensions of the kernel at the corresponding layer.
  38. 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]]
  39. # [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".
  40. # Note: Numbering starts from 1 for the first layer, which is not an acceptable value (no previous layer).
  41. # 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.
  42. # Default: [], no residual connections
  43. layersWithResidualConnNormal = [4,6,8]
  44. # [Optional] Layers to make of lower rank. Ala Yani Ioannou et al, "Training CNNs with Low-Rank Filters For Efficient Image Classification".
  45. # Example: [3,5] will make the 3rd and 5th layers of lower rank.
  46. # Default: []
  47. lowerRankLayersNormal = []
  48. # +++++++++++Subsampled pathway+++++++++++
  49. # [Optional] Specify whether to use a subsampled pathway. If False, all subsampled-related parameters will be read but disregarded in the model-construction.
  50. # Default: False
  51. useSubsampledPathway = True
  52. # [Optionals] The below parameters specify the subsampled-pathway architecture in a similar way as the normal.
  53. # 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).
  54. # [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.
  55. numberFMsPerLayerSubsampled = [30, 30, 40, 40, 40, 40, 50, 50]
  56. 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]]
  57. # [Optional] How much to downsample the image that the subsampled-pathway processes.
  58. # Requires either a) list of 3 integers, or b) list of lists of 3 integers.
  59. # 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).
  60. # 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.
  61. # Default: [[3,3,3]]
  62. subsampleFactor = [[3,3,3], [5,5,5]]
  63. # [Optional] Residual Connections for subsampled pathway. See corresponding parameter for normal pathway.
  64. # Default: mirrors the normal pathway, no residual connections
  65. layersWithResidualConnSubsampled = [4,6,8]
  66. # [Optional] Layers to make of lower rank. See corresponding parameter for normal pathway.
  67. # Default: Mirrors the normal pathway
  68. #lowerRankLayersSubsampled = []
  69. # +++++++++++FC Layers+++++++++++
  70. # [Optional] After the last layers of the normal and subsampled pathways are concatenated, additional Fully Connected hidden layers can be added before the final classification layer.
  71. # Specify a list, with as many entries as the number of ADDITIONAL FC layers (other than the classification layer) to add. The entries specify the number of Feature Maps to use.
  72. # Default: []
  73. numberFMsPerLayerFC = [250, 250]
  74. # [Optional] Specify dimensions of the kernel in the first FC layer. This kernel combines the features from multiple scales. Applies to the final Classification layer if no hidden FC layers in network.
  75. # Note: convolution with this kernel retains the size of the FMs (input is padded).
  76. # Default: [1,1,1]
  77. kernelDimFor1stFcLayer = [3,3,3]
  78. # [Optional] Residual Connections for the FC hidden layers. See corresponding parameter for normal pathway.
  79. # Default: [], no connections.
  80. layersWithResidualConnFC = [2]
  81. # +++++++++++Size of Image Segments+++++++++++
  82. # DeepMedic does not process patches of the image, but larger image-segments. Specify their size here.
  83. # [Required] Size of training segments influence the captured distribution of samples from the different classes (see DeepMedic paper)
  84. segmentsDimTrain = [37,37,37]
  85. # [Optional] The size of segments to use during the validation-on-samples process that is performed throughout training if requested.
  86. # Default: equal to receptive field, to validate on patches.
  87. segmentsDimVal = [17,17,17]
  88. # [Optional] Bigger image segments for Inference are safe to use and only speed up the process. Only limitation is the GPU memory.
  89. # Default: equal to the training segment.
  90. segmentsDimInference = [45,45,45]
  91. # [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.
  92. # 0 = no dropout. 1= 100% drop of the neurons. Empty list for no dropout.
  93. # Default: []
  94. dropoutRatesNormal = []
  95. dropoutRatesSubsampled = []
  96. # Default: 50% dropout on every Fully Connected layer except for the first one after the concatenation
  97. # Note: The list for FC rates should have one additional entry in comparison to "numberFMsPerLayerFC", for the classification layer.
  98. dropoutRatesFc = [0.0, 0.5, 0.5] # +1 for the classification layer!
  99. # [Optional] Initialization method for the conv kernel weights.
  100. # 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".
  101. # Default: ["fanIn", 2]
  102. convWeightsInit = ["fanIn", 2]
  103. # [Optional] Activation Function for all convolutional layers. Allowed: "linear", "relu", "prelu", "elu", "selu"
  104. # Default: "prelu"
  105. activationFunction = "prelu"
  106. # [Optional] Batch Normalization uses a rolling average of the mus and std for inference.
  107. # Specify over how many batches (SGD iterations) this moving average should be computed. Value <= 0 disables BN.
  108. # Default : 60
  109. rollAverageForBNOverThatManyBatches = 60