-
Notifications
You must be signed in to change notification settings - Fork 87
/
defaults.py
125 lines (105 loc) · 3.5 KB
/
defaults.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
from .config_node import ConfigNode
config = ConfigNode()
# option: MPIIGaze, MPIIFaceGaze
config.mode = 'MPIIGaze'
config.dataset = ConfigNode()
config.dataset.dataset_dir = 'datasets/MPIIGaze.h5'
# transform
config.transform = ConfigNode()
config.transform.mpiifacegaze_face_size = 224
config.transform.mpiifacegaze_gray = False
config.device = 'cuda'
config.model = ConfigNode()
config.model.name = 'lenet'
config.model.backbone = ConfigNode()
config.model.backbone.name = 'resnet_simple'
config.model.backbone.pretrained = 'resnet18'
config.model.backbone.resnet_block = 'basic'
config.model.backbone.resnet_layers = [2, 2, 2]
config.train = ConfigNode()
config.train.batch_size = 64
# optimizer (options: sgd, adam, amsgrad)
config.train.optimizer = 'sgd'
config.train.base_lr = 0.01
config.train.momentum = 0.9
config.train.nesterov = True
config.train.weight_decay = 1e-4
config.train.no_weight_decay_on_bn = False
# options: L1, L2, SmoothL1
config.train.loss = 'L2'
config.train.seed = 0
config.train.val_first = True
config.train.val_period = 1
config.train.test_id = 0
config.train.val_ratio = 0.1
config.train.output_dir = 'experiments/mpiigaze/exp00'
config.train.log_period = 100
config.train.checkpoint_period = 10
config.train.use_tensorboard = True
config.tensorboard = ConfigNode()
config.tensorboard.train_images = False
config.tensorboard.val_images = False
config.tensorboard.model_params = False
# optimizer
config.optim = ConfigNode()
# Adam
config.optim.adam = ConfigNode()
config.optim.adam.betas = (0.9, 0.999)
# scheduler
config.scheduler = ConfigNode()
config.scheduler.epochs = 40
# scheduler (options: multistep, cosine)
config.scheduler.type = 'multistep'
config.scheduler.milestones = [20, 30]
config.scheduler.lr_decay = 0.1
config.scheduler.lr_min_factor = 0.001
# train data loader
config.train.train_dataloader = ConfigNode()
config.train.train_dataloader.num_workers = 2
config.train.train_dataloader.drop_last = True
config.train.train_dataloader.pin_memory = False
config.train.val_dataloader = ConfigNode()
config.train.val_dataloader.num_workers = 1
config.train.val_dataloader.pin_memory = False
# test config
config.test = ConfigNode()
config.test.test_id = 0
config.test.checkpoint = ''
config.test.output_dir = ''
config.test.batch_size = 256
# test data loader
config.test.dataloader = ConfigNode()
config.test.dataloader.num_workers = 2
config.test.dataloader.pin_memory = False
# Face detector
config.face_detector = ConfigNode()
config.face_detector.mode = 'dlib'
config.face_detector.dlib = ConfigNode()
config.face_detector.dlib.model = 'data/dlib/shape_predictor_68_face_landmarks.dat'
# Gaze estimator
config.gaze_estimator = ConfigNode()
config.gaze_estimator.checkpoint = ''
config.gaze_estimator.camera_params = ''
config.gaze_estimator.normalized_camera_params = 'data/calib/normalized_camera_params_eye.yaml'
config.gaze_estimator.normalized_camera_distance = 0.6
# demo
config.demo = ConfigNode()
config.demo.use_camera = True
config.demo.display_on_screen = True
config.demo.wait_time = 1
config.demo.video_path = ''
config.demo.output_dir = ''
config.demo.output_file_extension = 'mp4'
config.demo.head_pose_axis_length = 0.05
config.demo.gaze_visualization_length = 0.05
config.demo.show_bbox = True
config.demo.show_head_pose = True
config.demo.show_landmarks = True
config.demo.show_normalized_image = False
config.demo.show_template_model = False
# cuDNN
config.cudnn = ConfigNode()
config.cudnn.benchmark = True
config.cudnn.deterministic = False
def get_default_config():
return config.clone()