example_spleen_segmentation / inference.json
Nic-Ma's picture
add checkpoint
13ec838
raw
history blame
3.85 kB
{
"dataset_dir": "/workspace/data/Task09_Spleen",
"ckpt_path": "/workspace/data//spleen_segmentation/models/model.pt",
"log": "$__import__('logging').basicConfig(level=20)",
"device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')",
"datalist": "$list(sorted(__import__('glob').glob(@dataset_dir + '/imagesTs/*.nii.gz')))",
"network_def": {
"_target_": "UNet",
"spatial_dims": 3,
"in_channels": 1,
"out_channels": 2,
"channels": [
16,
32,
64,
128,
256
],
"strides": [
2,
2,
2,
2
],
"num_res_units": 2,
"norm": "batch"
},
"network": "$@network_def.to(@device)",
"preprocessing": {
"_target_": "Compose",
"transforms": [
{
"_target_": "LoadImaged",
"keys": "image"
},
{
"_target_": "EnsureChannelFirstd",
"keys": "image"
},
{
"_target_": "Orientationd",
"keys": "image",
"axcodes": "RAS"
},
{
"_target_": "Spacingd",
"keys": "image",
"pixdim": [1.5, 1.5, 2.0],
"mode": "bilinear"
},
{
"_target_": "ScaleIntensityRanged",
"keys": "image",
"a_min": -57,
"a_max": 164,
"b_min": 0,
"b_max": 1,
"clip": true
},
{
"_target_": "EnsureTyped",
"keys": "image"
}
]
},
"dataset": {
"_target_": "Dataset",
"data": "$[{'image': i} for i in @datalist]",
"transform": "@preprocessing"
},
"dataloader": {
"_target_": "DataLoader",
"dataset": "@dataset",
"batch_size": 1,
"shuffle": false,
"num_workers": 4
},
"inferer": {
"_target_": "SlidingWindowInferer",
"roi_size": [
96,
96,
96
],
"sw_batch_size": 4,
"overlap": 0.5
},
"postprocessing": {
"_target_": "Compose",
"transforms": [
{
"_target_": "Activationsd",
"keys": "pred",
"softmax": true
},
{
"_target_": "Invertd",
"keys": "pred",
"transform": "@preprocessing",
"orig_keys": "image",
"meta_key_postfix": "meta_dict",
"nearest_interp": false,
"to_tensor": true
},
{
"_target_": "AsDiscreted",
"keys": "pred",
"argmax": true
},
{
"_target_": "SaveImaged",
"keys": "pred",
"meta_keys": "pred_meta_dict",
"output_dir": "eval"
}
]
},
"handlers": [
{
"_target_": "CheckpointLoader",
"_disabled_": "$not __import__('os').path.exists(@ckpt_path)",
"load_path": "@ckpt_path",
"load_dict": {"model": "@network"}
},
{
"_target_": "StatsHandler",
"_disabled_": "@log",
"iteration_log": false
}
],
"evaluator": {
"_target_": "SupervisedEvaluator",
"device": "@device",
"val_data_loader": "@dataloader",
"network": "@network",
"inferer": "@inferer",
"postprocessing": "@postprocessing",
"val_handlers": "@handlers",
"amp": false
}
}