Skip to content
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

Add option to validate at training start of deepedit #515

Merged
merged 11 commits into from
Oct 11, 2023
3 changes: 1 addition & 2 deletions models/spleen_deepedit_annotation/configs/evaluate.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"_target_": "SaveImaged",
"_disabled_": true,
"keys": "pred",
"meta_keys": "pred_meta_dict",
"output_dir": "@output_dir",
"resample": false,
"squeeze_end_dims": true
Expand Down Expand Up @@ -53,7 +52,7 @@
"metric_details": [
"val_mean_dice"
],
"batch_transform": "$monai.handlers.from_engine(['image_meta_dict'])",
"batch_transform": "$lambda x: [xx['image'].meta for xx in x]",
"summary_ops": "*"
}
],
Expand Down
36 changes: 22 additions & 14 deletions models/spleen_deepedit_annotation/configs/inference.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{
"imports": [
"$import glob",
"$import numpy",
"$import os",
"$import ignite"
],
"bundle_root": ".",
"image_key": "image",
"output_dir": "$@bundle_root + '/eval'",
"output_ext": ".nii.gz",
"output_dtype": "$numpy.float32",
"output_postfix": "trans",
"separate_folder": true,
"dataset_dir": "/workspace/Datasets/MSD_datasets/Task09_Spleen",
"datalist": "$list(sorted(glob.glob(@dataset_dir + '/imagesTs/*.nii.gz')))",
"label_names": {
Expand Down Expand Up @@ -63,21 +69,21 @@
"preprocessing_transforms": [
{
"_target_": "LoadImaged",
"keys": "image",
"keys": "@image_key",
"reader": "ITKReader"
},
{
"_target_": "EnsureChannelFirstd",
"keys": "image"
"keys": "@image_key"
},
{
"_target_": "Orientationd",
"keys": "image",
"keys": "@image_key",
"axcodes": "RAS"
},
{
"_target_": "ScaleIntensityRanged",
"keys": "image",
"keys": "@image_key",
"a_min": -175,
"a_max": 250,
"b_min": 0.0,
Expand All @@ -88,37 +94,37 @@
"deepedit_transforms": [
{
"_target_": "scripts.transforms.OrientationGuidanceMultipleLabelDeepEditd",
"ref_image": "image",
"ref_image": "@image_key",
"label_names": "@label_names"
},
{
"_target_": "AddGuidanceFromPointsDeepEditd",
"ref_image": "image",
"ref_image": "@image_key",
"guidance": "guidance",
"label_names": "@label_names"
},
{
"_target_": "Resized",
"keys": "image",
"keys": "@image_key",
"spatial_size": "@spatial_size",
"mode": "area"
},
{
"_target_": "ResizeGuidanceMultipleLabelDeepEditd",
"guidance": "guidance",
"ref_image": "image"
"ref_image": "@image_key"
},
{
"_target_": "AddGuidanceSignalDeepEditd",
"keys": "image",
"keys": "@image_key",
"guidance": "guidance",
"number_intensity_ch": "@number_intensity_ch"
}
],
"extra_transforms": [
{
"_target_": "EnsureTyped",
"keys": "image"
"keys": "@image_key"
}
],
"preprocessing": {
Expand Down Expand Up @@ -156,8 +162,7 @@
"_target_": "Invertd",
"keys": "pred",
"transform": "@preprocessing",
"orig_keys": "image",
"meta_key_postfix": "meta_dict",
"orig_keys": "@image_key",
"nearest_interp": false,
"to_tensor": true
},
Expand All @@ -169,8 +174,11 @@
{
"_target_": "SaveImaged",
"keys": "pred",
"meta_keys": "pred_meta_dict",
"output_dir": "@output_dir"
"output_dir": "@output_dir",
"output_ext": "@output_ext",
"output_dtype": "@output_dtype",
"output_postfix": "@output_postfix",
"separate_folder": "@separate_folder"
}
]
},
Expand Down
5 changes: 3 additions & 2 deletions models/spleen_deepedit_annotation/configs/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
"version": "0.5.0",
"version": "0.5.1",
"changelog": {
"0.5.1": "add option to validate at training start, and I/O param entries",
"0.5.0": "enable finetune and early stop",
"0.4.9": "fix orientation issue on clicks",
"0.4.8": "Add infer transforms to manage clicks from viewer",
Expand All @@ -27,7 +28,7 @@
"0.1.0": "complete the model package",
"0.0.1": "initialize the model package structure"
},
"monai_version": "1.2.0",
"monai_version": "1.3.0rc5",
"pytorch_version": "1.13.1",
"numpy_version": "1.22.2",
"optional_packages_version": {
Expand Down
2 changes: 2 additions & 0 deletions models/spleen_deepedit_annotation/configs/train.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"deepgrow_probability_train": 0.4,
"deepgrow_probability_val": 1.0,
"val_interval": 1,
"val_at_start": false,
"device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')",
"network_def": {
"_target_": "DynUNet",
Expand Down Expand Up @@ -324,6 +325,7 @@
"_target_": "ValidationHandler",
"validator": "@validate#evaluator",
"epoch_level": true,
"exec_at_start": "@val_at_start",
"interval": "@val_interval"
},
{
Expand Down
Loading