-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathgenerate_predictions.py
43 lines (33 loc) · 1.39 KB
/
generate_predictions.py
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
#!/usr/bin/env python
# coding: utf-8
# # FeTS Challenge
#
# Contributing Authors (alphabetical order):
# - Brandon Edwards (Intel)
# - Patrick Foley (Intel)
# - Micah Sheller (Intel)
from fets_challenge import model_outputs_to_disc
from pathlib import Path
import os
from sys import path
from fets_challenge.gandlf_csv_adapter import construct_fedsim_csv, extract_csv_partitions
device='cpu'
# infer participant home folder
home = str(Path.home())
# you will need to specify the correct experiment folder and the parent directory for
# the data you want to run inference over
checkpoint_folder='experiment_1'
#data_path = </PATH/TO/CHALLENGE_VALIDATION_DATA>
data_path = '/raid/datasets/FeTS22/MICCAI_FeTS2022_ValidationData'
# you can keep these the same if you wish
best_model_path = os.path.join(home, '.local/workspace/checkpoint', checkpoint_folder, 'best_model.pkl')
outputs_path = os.path.join(home, '.local/workspace/checkpoint', checkpoint_folder, 'model_outputs')
validation_csv_filename='validation.csv'
# Using this best model, we can now produce NIfTI files for model outputs
# using a provided data directory
model_outputs_to_disc(data_path=data_path,
validation_csv=validation_csv_filename,
output_path=outputs_path,
native_model_path=best_model_path,
outputtag='',
device=device)