[637b40]: / adpkd_segmentation / evaluation / evaluation_stats.py

Download this file

53 lines (40 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from pathlib import Path
from argparse import ArgumentParser
from adpkd_segmentation.inference.inference_utils import load_config
from adpkd_segmentation.evaluation.evaluation_utils import (
inference_to_disk,
compute_inference_stats,
)
parser = ArgumentParser()
parser.add_argument(
"--config_path",
type=str,
help="config_path for inference",
default=(
"experiments/runs/best_experiments/"
"2_new_stratified_run_2_long_advprop_640_batch_dice_1/val/val.yaml"
),
)
def run_evalutation_stats(
config_path,
SAVED_INFERENCE="saved_inference",
SAVED_FIGS="saved_figs",
):
# %%
# Run inferences
model_args = load_config(config_path=config_path)
# load_config initializes all objects including:
# model and datloader for InferenceDataset
inference_to_disk(*model_args)
# %%
compute_inference_stats(
save_dir="./saved_inference", display=True, output=True
)
# TODO: Add plots
if __name__ == "__main__":
args = parser.parse_args()
print("args ", args)
config_path = Path(args.config_path)
run_evalutation_stats(
config_path=config_path,
)