{ "imports": [ "$import glob", "$import os" ], "bundle_root": "/workspace/bundle/endoscopic_tool_segmentation", "output_dir": "$@bundle_root + '/eval'", "dataset_dir": "/workspace/data/endoscopic_tool_dataset", "datalist": "$list(sorted(glob.glob(os.path.join(@dataset_dir,'test', '*', '*[!seg].jpg'))))", "device": "$torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')", "network_def": { "_target_": "FlexibleUNet", "in_channels": 3, "out_channels": 2, "backbone": "efficientnet-b2", "spatial_dims": 2, "pretrained": false, "is_pad": false, "pre_conv": null }, "network": "$@network_def.to(@device)", "preprocessing": { "_target_": "Compose", "transforms": [ { "_target_": "LoadImaged", "keys": [ "image" ] }, { "_target_": "AsChannelFirstd", "keys": [ "image" ] }, { "_target_": "Resized", "keys": [ "image" ], "spatial_size": [ 736, 480 ], "mode": [ "bilinear" ] }, { "_target_": "ScaleIntensityd", "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_": "SimpleInferer" }, "postprocessing": { "_target_": "Compose", "transforms": [ { "_target_": "Invertd", "keys": "pred", "transform": "@preprocessing", "orig_keys": "image", "meta_key_postfix": "meta_dict", "nearest_interp": false, "to_tensor": true }, { "_target_": "AsDiscreted", "argmax": true, "to_onehot": 2, "keys": [ "pred" ] }, { "_target_": "Lambdad", "keys": [ "pred" ], "func": "$lambda x : x[1:]" }, { "_target_": "SaveImaged", "keys": "pred", "meta_keys": "pred_meta_dict", "output_dir": "@output_dir", "output_ext": ".png", "scale": 255, "squeeze_end_dims": true } ] }, "handlers": [ { "_target_": "CheckpointLoader", "load_path": "$@bundle_root + '/models/model.pt'", "load_dict": { "model": "@network" } }, { "_target_": "StatsHandler", "iteration_log": false } ], "evaluator": { "_target_": "SupervisedEvaluator", "device": "@device", "val_data_loader": "@dataloader", "network": "@network", "inferer": "@inferer", "postprocessing": "@postprocessing", "val_handlers": "@handlers" }, "evaluating": [ "$setattr(torch.backends.cudnn, 'benchmark', True)", "$@evaluator.run()" ] }