|
{ |
|
"whether_raw_luna16": false, |
|
"whether_resampled_luna16": "$(not @whether_raw_luna16)", |
|
"imports": [ |
|
"$import glob", |
|
"$import os" |
|
], |
|
"bundle_root": ".", |
|
"ckpt_dir": "$@bundle_root + '/models'", |
|
"output_dir": "$@bundle_root + '/eval'", |
|
"data_list_file_path": "$@bundle_root + '/LUNA16_datasplit/dataset_fold0.json'", |
|
"dataset_dir": "/datasets/LUNA16_Images_resample", |
|
"test_datalist": "$monai.data.load_decathlon_datalist(@data_list_file_path, is_segmentation=True, data_list_key='validation', base_dir=@dataset_dir)", |
|
"device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')", |
|
"amp": true, |
|
"spatial_dims": 3, |
|
"num_classes": 1, |
|
"force_sliding_window": false, |
|
"size_divisible": [ |
|
16, |
|
16, |
|
8 |
|
], |
|
"infer_patch_size": [ |
|
512, |
|
512, |
|
192 |
|
], |
|
"anchor_generator": { |
|
"_target_": "monai.apps.detection.utils.anchor_utils.AnchorGeneratorWithAnchorShape", |
|
"feature_map_scales": [ |
|
1, |
|
2, |
|
4 |
|
], |
|
"base_anchor_shapes": [ |
|
[ |
|
6, |
|
8, |
|
4 |
|
], |
|
[ |
|
8, |
|
6, |
|
5 |
|
], |
|
[ |
|
10, |
|
10, |
|
6 |
|
] |
|
] |
|
}, |
|
"backbone": "$monai.networks.nets.resnet.resnet50(spatial_dims=3,n_input_channels=1,conv1_t_stride=[2,2,1],conv1_t_size=[7,7,7])", |
|
"feature_extractor": "$monai.apps.detection.networks.retinanet_network.resnet_fpn_feature_extractor(@backbone,3,False,[1,2],None)", |
|
"network_def": { |
|
"_target_": "RetinaNet", |
|
"spatial_dims": "@spatial_dims", |
|
"num_classes": "@num_classes", |
|
"num_anchors": 3, |
|
"feature_extractor": "@feature_extractor", |
|
"size_divisible": "@size_divisible", |
|
"use_list_output": false |
|
}, |
|
"network": "$@network_def.to(@device)", |
|
"detector": { |
|
"_target_": "RetinaNetDetector", |
|
"network": "@network", |
|
"anchor_generator": "@anchor_generator", |
|
"debug": false, |
|
"spatial_dims": "@spatial_dims", |
|
"num_classes": "@num_classes", |
|
"size_divisible": "@size_divisible" |
|
}, |
|
"detector_ops": [ |
|
"[email protected]_target_keys(box_key='box', label_key='label')", |
|
"[email protected]_box_selector_parameters(score_thresh=0.02,topk_candidates_per_level=1000,nms_thresh=0.22,detections_per_img=300)", |
|
"[email protected]_sliding_window_inferer(roi_size=@infer_patch_size,overlap=0.25,sw_batch_size=1,mode='constant',device='cpu')" |
|
], |
|
"preprocessing": { |
|
"_target_": "Compose", |
|
"transforms": [ |
|
{ |
|
"_target_": "LoadImaged", |
|
"keys": "image", |
|
"meta_key_postfix": "meta_dict", |
|
"_disabled_": "@whether_raw_luna16" |
|
}, |
|
{ |
|
"_target_": "LoadImaged", |
|
"keys": "image", |
|
"meta_key_postfix": "meta_dict", |
|
"reader": "itkreader", |
|
"affine_lps_to_ras": true, |
|
"_disabled_": "@whether_resampled_luna16" |
|
}, |
|
{ |
|
"_target_": "EnsureChannelFirstd", |
|
"keys": "image", |
|
"meta_key_postfix": "meta_dict" |
|
}, |
|
{ |
|
"_target_": "Orientationd", |
|
"keys": "image", |
|
"axcodes": "RAS" |
|
}, |
|
{ |
|
"_target_": "Spacingd", |
|
"keys": "image", |
|
"pixdim": [ |
|
0.703125, |
|
0.703125, |
|
1.25 |
|
], |
|
"_disabled_": "@whether_resampled_luna16" |
|
}, |
|
{ |
|
"_target_": "ScaleIntensityRanged", |
|
"keys": "image", |
|
"a_min": -1024.0, |
|
"a_max": 300.0, |
|
"b_min": 0.0, |
|
"b_max": 1.0, |
|
"clip": true |
|
}, |
|
{ |
|
"_target_": "EnsureTyped", |
|
"keys": "image" |
|
} |
|
] |
|
}, |
|
"dataset": { |
|
"_target_": "Dataset", |
|
"data": "$@test_datalist", |
|
"transform": "@preprocessing" |
|
}, |
|
"dataloader": { |
|
"_target_": "DataLoader", |
|
"dataset": "@dataset", |
|
"batch_size": 1, |
|
"shuffle": false, |
|
"num_workers": 4, |
|
"collate_fn": "$monai.data.utils.no_collation" |
|
}, |
|
"inferer": { |
|
"_target_": "scripts.detection_inferer.RetinaNetInferer", |
|
"detector": "@detector", |
|
"force_sliding_window": "@force_sliding_window" |
|
}, |
|
"postprocessing": { |
|
"_target_": "Compose", |
|
"transforms": [ |
|
{ |
|
"_target_": "ClipBoxToImaged", |
|
"box_keys": "box", |
|
"label_keys": "label", |
|
"box_ref_image_keys": "image", |
|
"remove_empty": true |
|
}, |
|
{ |
|
"_target_": "AffineBoxToWorldCoordinated", |
|
"box_keys": "box", |
|
"box_ref_image_keys": "image", |
|
"image_meta_key_postfix": "meta_dict", |
|
"affine_lps_to_ras": true |
|
}, |
|
{ |
|
"_target_": "ConvertBoxModed", |
|
"box_keys": "box", |
|
"src_mode": "xyzxyz", |
|
"dst_mode": "cccwhd" |
|
}, |
|
{ |
|
"_target_": "DeleteItemsd", |
|
"keys": [ |
|
"image" |
|
] |
|
} |
|
] |
|
}, |
|
"handlers": [ |
|
{ |
|
"_target_": "CheckpointLoader", |
|
"load_path": "$@bundle_root + '/models/model.pt'", |
|
"load_dict": { |
|
"model": "@network" |
|
} |
|
}, |
|
{ |
|
"_target_": "StatsHandler", |
|
"iteration_log": false |
|
}, |
|
{ |
|
"_target_": "scripts.detection_saver.DetectionSaver", |
|
"output_dir": "@output_dir", |
|
"filename": "result_luna16_fold0.json", |
|
"batch_transform": "$lambda x: [xx['image_meta_dict'] for xx in x]", |
|
"output_transform": "$lambda x: [@postprocessing({**xx['pred'],'image':xx['image']}) for xx in x]", |
|
"pred_box_key": "box", |
|
"pred_label_key": "label", |
|
"pred_score_key": "label_scores" |
|
} |
|
], |
|
"evaluator": { |
|
"_target_": "scripts.evaluator.DetectionEvaluator", |
|
"_requires_": "@detector_ops", |
|
"device": "@device", |
|
"val_data_loader": "@dataloader", |
|
"network": "@network", |
|
"inferer": "@inferer", |
|
"val_handlers": "@handlers", |
|
"amp": "@amp" |
|
}, |
|
"initialize": [ |
|
"$setattr(torch.backends.cudnn, 'benchmark', True)" |
|
], |
|
"run": [ |
|
"[email protected]()" |
|
] |
|
} |
|
|