forked from fanxiule/CRD_Fusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval_options.py
108 lines (102 loc) · 5.7 KB
/
eval_options.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import os
import argparse
class EvalOptions:
def __init__(self):
self.options = None
self.parser = argparse.ArgumentParser(description="CRD_Fusion Validation Options")
# DIRECTORIES
self.parser.add_argument("--data_path",
type=str,
help="directory where datasets are saved",
default=os.getenv('data_path'))
# default=os.path.expanduser("~/Documents/Datasets/")
self.parser.add_argument("--checkpt",
type=str,
help="directory to pretrained checkpoint files",
default="models/SceneFlow")
self.parser.add_argument("--log_dir",
type=str,
help="directory to save Tensorboard event and optionally the predicted disparity map",
default="models")
# DATASET options
self.parser.add_argument("--dataset",
type=str,
help="dataset to train on",
default="SceneFlow",
choices=["kitti2015", "kitti2012", "SceneFlow"])
self.parser.add_argument("--resized_height",
type=int,
help="image height after resizing",
default=544)
self.parser.add_argument("--resized_width",
type=int,
help="image width after resizing",
default=960)
self.parser.add_argument("--downscale",
type=int,
help="downscaling factor before image resizing",
default=1)
self.parser.add_argument("--max_disp",
type=int,
help="maximum disparity for prediction at the full spatial resolution. Must agree with "
"the checkpoint files",
default=192)
# EVALUATION options
self.parser.add_argument("--model_name",
type=str,
help="name of the folder where the tensorboard event and/or predicted disparity maps "
"will be saved",
default="crd_fusion_eval")
self.parser.add_argument("--save_pred",
action="store_true",
help="if set, the predicted disparity maps and occlusion masks are saved in .npy format")
self.parser.add_argument("--device",
type=str,
help="evaluation device",
choices=["cpu", "cuda"],
default="cuda")
self.parser.add_argument("--num_workers",
type=int,
help="number of dataloader workers",
default=0)
self.parser.add_argument("--log_frequency",
type=int,
help="tensorboard logging frequency in number of batches",
default=10)
# For ablation
# THEY SHOULD BE SET SUCH THAT THEY ARE CONSISTENT WITH THE CHECKPOINT
self.parser.add_argument("--conf_threshold",
type=float,
help="if a confidence score is lower than the threshold, it will be replaced by 0",
default=0.8)
self.parser.add_argument("--imagenet_norm",
action="store_true",
help="if set, the RGB images are normalized by ImageNet mean and variance")
self.parser.add_argument("--feature_downscale",
type=int,
help="downscaling factor during feature extraction. If set to 3, the image wil be "
"downscaled to 1/(2^3)=1/8 of the original resolution",
choices=range(1, 4),
default=3)
self.parser.add_argument("--multi_step_upsample",
action="store_true",
help="if set, the coarse disparity map is upsampled gradually during refinement")
self.parser.add_argument("--fusion",
action="store_true",
help="if set, raw disparity fusion is applied to the model")
self.parser.add_argument("--baseline",
action="store_true",
help="if set, the baseline model is used")
self.parser.add_argument("--occ_detection",
action="store_true",
help="if set, occlusion mask is calculated and applied in loss function")
self.parser.add_argument("--occ_threshold",
type=float,
help="threshold for occlusion mask",
default=0.8)
self.parser.add_argument("--post_processing",
action="store_true",
help="if set, post processing is applied")
def parse(self):
self.options = self.parser.parse_args()
return self.options