示例#1
0
######## PREDICTION ########

log_dir = "learn2reg_t1_paired_train_logs"

log_dir_tr = "demos/paired_mrus_brain/learn2reg_t1_paired_train_logs"
ckpt_path = os.path.join(log_dir_tr, "save", "weights-epoch800.ckpt")
config_path = os.path.join(log_dir_tr, "config.yaml")

gpu = ""
gpu_allow_growth = False
predict(
    gpu=gpu,
    gpu_allow_growth=gpu_allow_growth,
    config_path=config_path,
    ckpt_path=ckpt_path,
    mode="test",
    batch_size=1,
    log_dir=log_dir,
    sample_label="all",
    save_png=True,
)

# the numerical metrics are saved in the logs directory specified

######## VISUALISATION ########

# Now lets load in a few samples from the predicitons and plot them

# change the following line to the path to image0 label0
path_to_image0_label0 = r"logs/learn2reg_t1_paired_train_logs/test"
path_to_pred_fixed_img = os.path.join(path_to_image0_label0,
示例#2
0
    "\n\n\n\n\n"
    "=========================================================\n"
    "The prediction can also be launched using the following command.\n"
    "deepreg_predict --gpu '' "
    f"--config_path demos/{name}/{name}_{method}.yaml "
    f"--ckpt_path demos/{name}/dataset/pretrained/{method}/weights-epoch{ckpt_index}.ckpt "
    f"--log_dir demos/{name} "
    f"--log_dir logs_predict/{method} "
    "--save_png --split test\n"
    "=========================================================\n"
    "\n\n\n\n\n"
)

log_dir = f"demos/{name}"
exp_name = f"logs_predict/{method}/" + datetime.now().strftime("%Y%m%d-%H%M%S")
ckpt_path = f"{log_dir}/dataset/pretrained/{method}/weights-epoch{ckpt_index}.ckpt"
config_path = [f"{log_dir}/{name}_{method}.yaml"]
if args.test:
    config_path.append("config/test/demo_unpaired_grouped.yaml")

predict(
    gpu="0",
    gpu_allow_growth=True,
    ckpt_path=ckpt_path,
    split="test",
    batch_size=1,
    log_dir=log_dir,
    exp_name=exp_name,
    config_path=config_path,
)
示例#3
0
print("\n\n\n\n\n"
      "=========================================================\n"
      "The prediction can also be launched using the following command.\n"
      "deepreg_predict --gpu '' "
      f"--config_path demos/{name}/{name}.yaml "
      f"--ckpt_path demos/{name}/dataset/pretrained/ckpt-5000 "
      f"--log_root demos/{name} "
      "--log_dir logs_predict "
      "--save_png --mode test\n"
      "=========================================================\n"
      "\n\n\n\n\n")

log_root = f"demos/{name}"
log_dir = "logs_predict/" + datetime.now().strftime("%Y%m%d-%H%M%S")
ckpt_path = f"{log_root}/dataset/pretrained/ckpt-5000"
config_path = [f"{log_root}/{name}.yaml"]
if args.test:
    config_path.append("config/test/demo_unpaired_grouped.yaml")

predict(
    gpu="0",
    gpu_allow_growth=True,
    ckpt_path=ckpt_path,
    mode="test",
    batch_size=1,
    log_root=log_root,
    log_dir=log_dir,
    sample_label="all",
    config_path=config_path,
)