forked from B-Manifold/pytorch_fnet_UwUnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evaluate_model.py
50 lines (32 loc) · 1.38 KB
/
evaluate_model.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
44
45
46
47
48
49
import argparse
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from fnet.utils.figures import evaluate_model, eval_images, print_stats_all, print_stats_all_v2
import logging
import os
import pandas as pd
import sys
import warnings
import numpy as np
import glob
import pickle
import pdb
def str2bool(v):
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--predictions_file', default=None, help='two column .csv of paths to path_prediction and path_target')
parser.add_argument('--predictions_dir', default=None, help='project directory. Mutually exclusive of predictions_dir')
parser.add_argument('--path_save_dir', default='saved_models', help='base directory for saving results')
parser.add_argument('--save_error_maps', type=str2bool, default=False, help='Save error map images')
parser.add_argument('--overwrite', type=str2bool, default=True, help='overwrite previous results')
parser.add_argument('--reference_file', default=None, help='directory or images for calculating c_max')
opts = parser.parse_args()
print(opts)
evaluate_model(**vars(opts))