katielink's picture
unify naming
c050f44
{
"imports": [
"$import glob"
],
"bundle_root": ".",
"device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')",
"ckpt_path": "$@bundle_root + '/models/model.pt'",
"dataset_dir": "/workspace/data",
"output_dir": "./output",
"datalist": "$list(sorted(glob.glob(@dataset_dir + '/*.nii*')))",
"network_def": {
"_target_": "UNet",
"spatial_dims": 2,
"in_channels": 1,
"out_channels": 4,
"channels": [
16,
32,
64,
128,
256
],
"strides": [
2,
2,
2,
2
],
"num_res_units": 2
},
"network": "$@network_def.to(@device)",
"preprocessing": {
"_target_": "Compose",
"transforms": [
{
"_target_": "LoadImaged",
"keys": "image"
},
{
"_target_": "EnsureChannelFirstd",
"keys": "image"
},
{
"_target_": "ScaleIntensityd",
"keys": "image"
},
{
"_target_": "EnsureTyped",
"keys": "image",
"device": "@device"
}
]
},
"dataset": {
"_target_": "Dataset",
"data": "$[{'image': i} for i in @datalist]",
"transform": "@preprocessing"
},
"dataloader": {
"_target_": "DataLoader",
"dataset": "@dataset",
"batch_size": 1,
"shuffle": false,
"num_workers": 0
},
"inferer": {
"_target_": "SliceInferer",
"roi_size": [
256,
256
],
"spatial_dim": 2
},
"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": "@output_dir"
}
]
},
"handlers": [
{
"_target_": "CheckpointLoader",
"load_path": "@ckpt_path",
"load_dict": {
"model": "@network"
}
}
],
"evaluator": {
"_target_": "SupervisedEvaluator",
"device": "@device",
"val_data_loader": "@dataloader",
"network": "@network",
"inferer": "@inferer",
"postprocessing": "@postprocessing",
"val_handlers": "@handlers"
},
"evaluating": [
"$@evaluator.run()"
]
}