deepsulci.pattern_classification.capsul.resnet_training.PatternDeepTraining

PatternDeepTraining

Process to train a 3D ResNet-18 to recognize a searched fold pattern.

This process consists of three steps. Each step depends on the previous step. However, they can be started independently if the previous steps have already been completed.

The first step is to extract from the graphs the data useful for training the neural networks (buckets, labels and bounding box of the names_filter). These data are stored in Jason files (buckets and labels in traindata_file and bounding box in param_file).

The second step allows to set the hyperparameters (learning rate and momentum) by 3-fold cross-validation.These hyperparameters are saved in the Jason file param_file.

The third step is to train the 18-layer 3D ResNet neural network on the data. The neural network parameters are saved in the file model_param.mdsm

The model takes approximately 3 hours to be trained on the GPU with a training database of 100 subjects (step 1: 15min, step 2: 2h30, step 3: 10min).

Warning: The searched pattern must have been manually labeled on the graphs of the training database containing it.

Note

  • Type ‘PatternDeepTraining.help()’ for a full description of this process parameters.

  • Type ‘<PatternDeepTraining>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<PatternDeepTraining>.get_output_spec()’ for a full description of this process output trait types.

Inputs

[Mandatory]

graphs: a legal value ([‘List_File’] - mandatory)

training base graphs

pattern: a string ([‘Str’] - mandatory)

vertex name representing the searched pattern

names_filter: a legal value ([‘List_Str’] - mandatory)

list of vertex names defining the bounding box used as input for the neural network

cuda: an integer ([‘Int’] - mandatory)

device on which to run the training(-1 for cpu, i>=0 for the i-th gpu)

[Optional]

batch_size: an integer ([‘Int’] - optional)

batch size used to train the neural network

step_1: a boolean ([‘Bool’] - optional)

perform the data extraction step from the graphs

step_2: a boolean ([‘Bool’] - optional)

perform the hyperparameter tuning step (learning rate and momentum)

step_3: a boolean ([‘Bool’] - optional)

perform the model training step

Outputs

model_file: a string or os.PathLike object ([‘File (filename: input)’] - mandatory)

file (.mdsm) storing neural network parameters

param_file: a string or os.PathLike object ([‘File (filename: input)’] - mandatory)

file (.json) storing the hyperparameters (bounding_box, learning rate and momentum)

traindata_file: a string or os.PathLike object ([‘File (filename: input)’] - mandatory)

file (.json) storing the data extracted from the training base graphs