-
Notifications
You must be signed in to change notification settings - Fork 90
Added ability to customize segmentation #1014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| # Choose the segmentation model here | ||
| # options: unet, resunet, fcn | ||
| version: | ||
| { | ||
| minimum: 0.0.14, | ||
| maximum: 0.1.5 | ||
| } | ||
| model: | ||
| { | ||
| dimension: 3, # the dimension of the model and dataset: defines dimensionality of computations | ||
| base_filters: 32, # Set base filters: number of filters present in the initial module of the U-Net convolution; for IncU-Net, keep this divisible by 4 | ||
| architecture: resunet, # options: unet, resunet, fcn, uinc | ||
| final_layer: sigmoid, # can be either sigmoid, softmax or none (none == regression) | ||
| norm_type: instance, # can be either batch or instance | ||
| class_list: [0, 255], # Set the list of labels the model should train on and predict | ||
| amp: False, # Set if you want to use Automatic Mixed Precision for your operations or not - options: True, False | ||
| # n_channels: 3, # set the input channels - useful when reading RGB or images that have vectored pixel types | ||
| } | ||
| metrics: | ||
| - dice | ||
| - precision | ||
| - iou | ||
| - f1 | ||
| - recall: { average: macro } | ||
| problem_type: segmentation_brats | ||
| verbose: True | ||
| inference_mechanism: { grid_aggregator_overlap: average, patch_overlap: 0 } | ||
| modality: rad | ||
| # Patch size during training - 2D patch for breast images since third dimension is not patched | ||
| patch_size: [32, 32, 32] | ||
| # Number of epochs | ||
| num_epochs: 1 | ||
| patience: 1 | ||
| # Set the batch size | ||
| batch_size: 1 | ||
| # Set the initial learning rate | ||
| learning_rate: 0.001 | ||
| # Set the learning rate scheduler i.e. the way the initial learning rate must be updated while the training progresses | ||
| # Options: steplr, exponentiallr, cosineannealinglr, reducelronplateau, cycliclr | ||
| scheduler: triangle | ||
| # Set which loss function you want to use - options : 'dc' - for dice only, 'dcce' - for sum of dice and CE and you can guess the next (only lower-case please) | ||
| # options: dc (dice only), ce (), dcce (sume of dice and ce), mse (), ... | ||
| loss_function: dc | ||
| weighted_loss: True | ||
| # Which optimizer do you want to use - adam/sgd | ||
| optimizer: adam | ||
| # the value of 'k' for cross-validation, this is the percentage of total training data to use as validation; | ||
| # randomized split is performed using sklearn's KFold method | ||
| # for single fold run, use '-' before the fold number | ||
| nested_training: { | ||
| testing: -5, # this controls the holdout data splits for final model evaluation; use '1' if this is to be disabled | ||
| validation: -5, # this controls the validation data splits for model training | ||
| } | ||
| # various data augmentation techniques | ||
| # options: affine, elastic, downsample, motion, ghosting, bias, blur, gaussianNoise, swap | ||
| # keep/edit as needed | ||
| # all transforms: https://torchio.readthedocs.io/transforms/transforms.html?highlight=transforms | ||
| data_augmentation: {} | ||
| # 'spatial':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'kspace':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'bias':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'blur':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'noise':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'swap':{ | ||
| # 'probability': 0.5 | ||
| # } | ||
| data_preprocessing: { | ||
| # 'threshold':{ | ||
| # 'min': 10, | ||
| # 'max': 75 | ||
| # }, | ||
| # 'clip':{ | ||
| # 'min': 10, | ||
| # 'max': 75 | ||
| # }, | ||
| "normalize", | ||
| # 'resample':{ | ||
| # 'resolution': [1,2,3] | ||
| # }, | ||
| #'resize': [128,128], # this is generally not recommended, as it changes image properties in unexpected ways | ||
| } | ||
| # data postprocessing node | ||
| data_postprocessing: {} | ||
| # 'largest_component', | ||
| # 'hole_filling' | ||
| # parallel training on HPC - here goes the command to prepend to send to a high performance computing | ||
| # cluster for parallel computing during multi-fold training | ||
| # not used for single fold training | ||
| # this gets passed before the training_loop, so ensure enough memory is provided along with other parameters | ||
| # that your HPC would expect | ||
| # ${outputDir} will be changed to the outputDir you pass in CLI + '/${fold_number}' | ||
| #parallel_compute_command: <insert parallel command here> | ||
|
|
||
| q_max_length: 1 | ||
|
|
||
| q_samples_per_volume: 1 | ||
|
|
||
| q_num_workers: 0 | ||
|
|
||
| panoptica: !Panoptica_Evaluator | ||
| decision_metric: null | ||
| decision_threshold: null | ||
| edge_case_handler: !EdgeCaseHandler | ||
| empty_list_std: !EdgeCaseResult NAN | ||
| listmetric_zeroTP_handling: | ||
| !Metric DSC: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult ZERO, | ||
| empty_reference_result: !EdgeCaseResult ZERO, no_instances_result: !EdgeCaseResult NAN, | ||
| normal: !EdgeCaseResult ZERO} | ||
| !Metric NSD: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult INF, | ||
| empty_reference_result: !EdgeCaseResult INF, no_instances_result: !EdgeCaseResult NAN, | ||
| normal: !EdgeCaseResult INF} | ||
| expected_input: !InputType SEMANTIC | ||
| global_metrics: [!Metric DSC] | ||
| instance_approximator: !ConnectedComponentsInstanceApproximator {cca_backend: null} | ||
| instance_matcher: !NaiveThresholdMatching {allow_many_to_one: false, matching_metric: !Metric IOU, | ||
| matching_threshold: 0.5} | ||
| instance_metrics: [!Metric DSC, !Metric NSD] | ||
| log_times: false | ||
| save_group_times: false | ||
| segmentation_class_groups: !SegmentationClassGroups | ||
| groups: | ||
| snfh: !LabelGroup | ||
| single_instance: false | ||
| value_labels: [2] | ||
| et: !LabelGroup | ||
| single_instance: false | ||
| value_labels: [3] | ||
| netc: !LabelGroup | ||
| single_instance: false | ||
| value_labels: [1] | ||
| rc: !LabelGroup | ||
| single_instance: false | ||
| value_labels: [4] | ||
| tc: !LabelMergeGroup | ||
| single_instance: false | ||
| value_labels: [1, 3, 4] | ||
| wt: !LabelMergeGroup | ||
| single_instance: false | ||
| value_labels: [1, 2, 3, 4] | ||
| verbose: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| # Choose the segmentation model here | ||
| # options: unet, resunet, fcn | ||
| version: | ||
| { | ||
| minimum: 0.0.14, | ||
| maximum: 0.1.5 | ||
| } | ||
| model: | ||
| { | ||
| dimension: 3, # the dimension of the model and dataset: defines dimensionality of computations | ||
| base_filters: 32, # Set base filters: number of filters present in the initial module of the U-Net convolution; for IncU-Net, keep this divisible by 4 | ||
| architecture: resunet, # options: unet, resunet, fcn, uinc | ||
| final_layer: sigmoid, # can be either sigmoid, softmax or none (none == regression) | ||
| norm_type: instance, # can be either batch or instance | ||
| class_list: [0, 255], # Set the list of labels the model should train on and predict | ||
| amp: False, # Set if you want to use Automatic Mixed Precision for your operations or not - options: True, False | ||
| # n_channels: 3, # set the input channels - useful when reading RGB or images that have vectored pixel types | ||
| } | ||
| metrics: | ||
| - dice | ||
| - precision | ||
| - iou | ||
| - f1 | ||
| - recall: { average: macro } | ||
| problem_type: segmentation_brats | ||
| verbose: True | ||
| inference_mechanism: { grid_aggregator_overlap: average, patch_overlap: 0 } | ||
| modality: rad | ||
| # Patch size during training - 2D patch for breast images since third dimension is not patched | ||
| patch_size: [32, 32, 32] | ||
| # Number of epochs | ||
| num_epochs: 1 | ||
| patience: 1 | ||
| # Set the batch size | ||
| batch_size: 1 | ||
| # Set the initial learning rate | ||
| learning_rate: 0.001 | ||
| # Set the learning rate scheduler i.e. the way the initial learning rate must be updated while the training progresses | ||
| # Options: steplr, exponentiallr, cosineannealinglr, reducelronplateau, cycliclr | ||
| scheduler: triangle | ||
| # Set which loss function you want to use - options : 'dc' - for dice only, 'dcce' - for sum of dice and CE and you can guess the next (only lower-case please) | ||
| # options: dc (dice only), ce (), dcce (sume of dice and ce), mse (), ... | ||
| loss_function: dc | ||
| weighted_loss: True | ||
| # Which optimizer do you want to use - adam/sgd | ||
| optimizer: adam | ||
| # the value of 'k' for cross-validation, this is the percentage of total training data to use as validation; | ||
| # randomized split is performed using sklearn's KFold method | ||
| # for single fold run, use '-' before the fold number | ||
| nested_training: { | ||
| testing: -5, # this controls the holdout data splits for final model evaluation; use '1' if this is to be disabled | ||
| validation: -5, # this controls the validation data splits for model training | ||
| } | ||
| # various data augmentation techniques | ||
| # options: affine, elastic, downsample, motion, ghosting, bias, blur, gaussianNoise, swap | ||
| # keep/edit as needed | ||
| # all transforms: https://torchio.readthedocs.io/transforms/transforms.html?highlight=transforms | ||
| data_augmentation: {} | ||
| # 'spatial':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'kspace':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'bias':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'blur':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'noise':{ | ||
| # 'probability': 0.5 | ||
| # }, | ||
| # 'swap':{ | ||
| # 'probability': 0.5 | ||
| # } | ||
| data_preprocessing: { | ||
| # 'threshold':{ | ||
| # 'min': 10, | ||
| # 'max': 75 | ||
| # }, | ||
| # 'clip':{ | ||
| # 'min': 10, | ||
| # 'max': 75 | ||
| # }, | ||
| "normalize", | ||
| # 'resample':{ | ||
| # 'resolution': [1,2,3] | ||
| # }, | ||
| #'resize': [128,128], # this is generally not recommended, as it changes image properties in unexpected ways | ||
| } | ||
| # data postprocessing node | ||
| data_postprocessing: {} | ||
| # 'largest_component', | ||
| # 'hole_filling' | ||
| # parallel training on HPC - here goes the command to prepend to send to a high performance computing | ||
| # cluster for parallel computing during multi-fold training | ||
| # not used for single fold training | ||
| # this gets passed before the training_loop, so ensure enough memory is provided along with other parameters | ||
| # that your HPC would expect | ||
| # ${outputDir} will be changed to the outputDir you pass in CLI + '/${fold_number}' | ||
| #parallel_compute_command: <insert parallel command here> | ||
|
|
||
| q_max_length: 1 | ||
|
|
||
| q_samples_per_volume: 1 | ||
|
|
||
| q_num_workers: 0 | ||
|
|
||
| panoptica: !Panoptica_Evaluator | ||
| decision_metric: null | ||
| decision_threshold: null | ||
| edge_case_handler: !EdgeCaseHandler | ||
| empty_list_std: !EdgeCaseResult NAN | ||
| listmetric_zeroTP_handling: | ||
| !Metric DSC: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult ZERO, | ||
| empty_reference_result: !EdgeCaseResult ZERO, no_instances_result: !EdgeCaseResult NAN, | ||
| normal: !EdgeCaseResult ZERO} | ||
| !Metric clDSC: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult ZERO, | ||
| empty_reference_result: !EdgeCaseResult ZERO, no_instances_result: !EdgeCaseResult NAN, | ||
| normal: !EdgeCaseResult ZERO} | ||
| !Metric IOU: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult ZERO, | ||
| empty_reference_result: !EdgeCaseResult ZERO, no_instances_result: !EdgeCaseResult NAN, | ||
| normal: !EdgeCaseResult ZERO} | ||
| !Metric NSD: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult INF, | ||
| empty_reference_result: !EdgeCaseResult INF, no_instances_result: !EdgeCaseResult NAN, | ||
| normal: !EdgeCaseResult INF} | ||
| !Metric HD95: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult INF, | ||
| empty_reference_result: !EdgeCaseResult INF, no_instances_result: !EdgeCaseResult NAN, | ||
| normal: !EdgeCaseResult INF} | ||
| !Metric RVD: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult NAN, | ||
| empty_reference_result: !EdgeCaseResult NAN, no_instances_result: !EdgeCaseResult NAN, | ||
| normal: !EdgeCaseResult NAN} | ||
| !Metric RVAE: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult NAN, | ||
| empty_reference_result: !EdgeCaseResult NAN, no_instances_result: !EdgeCaseResult NAN, | ||
| normal: !EdgeCaseResult NAN} | ||
| expected_input: !InputType SEMANTIC | ||
| global_metrics: [!Metric DSC] | ||
| instance_approximator: !ConnectedComponentsInstanceApproximator {cca_backend: null} | ||
| instance_matcher: !NaiveThresholdMatching {allow_many_to_one: false, matching_metric: !Metric IOU, | ||
|
sarthakpati marked this conversation as resolved.
|
||
| matching_threshold: 0.5} | ||
| instance_metrics: [!Metric DSC, !Metric IOU, !Metric RVD, !Metric NSD, !Metric HD95] | ||
|
sarthakpati marked this conversation as resolved.
|
||
| log_times: false | ||
| save_group_times: false | ||
| segmentation_class_groups: !SegmentationClassGroups | ||
| groups: | ||
|
scap3yvt marked this conversation as resolved.
|
||
| ed: !LabelGroup | ||
| single_instance: false | ||
| value_labels: [2] | ||
| et: !LabelGroup | ||
| single_instance: false | ||
| value_labels: [3] | ||
| net: !LabelGroup | ||
| single_instance: false | ||
| value_labels: [1] | ||
| tc: !LabelMergeGroup | ||
| single_instance: false | ||
| value_labels: [1, 3] | ||
| wt: !LabelMergeGroup | ||
| single_instance: false | ||
| value_labels: [1, 2, 3, 4] | ||
| verbose: false | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.